diff --git a/tests/NexusReader.Application.Tests/Services/EpubMetadataExtractorTests.cs b/tests/NexusReader.Application.Tests/Services/EpubMetadataExtractorTests.cs new file mode 100644 index 0000000..6b25ba5 --- /dev/null +++ b/tests/NexusReader.Application.Tests/Services/EpubMetadataExtractorTests.cs @@ -0,0 +1,28 @@ +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); + } +}