29 lines
726 B
C#
29 lines
726 B
C#
using NexusReader.Infrastructure.Services;
|
|
using Xunit;
|
|
|
|
namespace NexusReader.Application.Tests.Services;
|
|
|
|
public class EpubMetadataExtractorTests
|
|
{
|
|
private readonly EpubMetadataExtractor _sut;
|
|
|
|
public EpubMetadataExtractorTests()
|
|
{
|
|
_sut = new EpubMetadataExtractor();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ExtractMetadataAsync_WithInvalidStream_ReturnsFailure()
|
|
{
|
|
// Arrange
|
|
using var invalidStream = new MemoryStream(new byte[] { 0, 1, 2, 3 });
|
|
|
|
// Act
|
|
var result = await _sut.ExtractMetadataAsync(invalidStream);
|
|
|
|
// Assert
|
|
Assert.True(result.IsFailed);
|
|
Assert.Contains("Failed to extract EPUB metadata", result.Errors[0].Message);
|
|
}
|
|
}
|