File size: 1,285 Bytes
fab29d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using VersOne.Epub.Schema;

namespace VersOne.Epub.Test.Unit.Schema.Opf.Metadata
{
    public class EpubMetadataSourceTests
    {
        private const string SOURCE = "https://example.com/books/123/content.html";
        private const string ID = "source";

        [Fact(DisplayName = "Constructing a EpubMetadataSource instance with non-null parameters should succeed")]
        public void ConstructorWithNonNullParametersTest()
        {
            EpubMetadataSource epubMetadataSource = new(SOURCE, ID);
            Assert.Equal(SOURCE, epubMetadataSource.Source);
            Assert.Equal(ID, epubMetadataSource.Id);
        }

        [Fact(DisplayName = "Constructor should throw ArgumentNullException if source parameter is null")]
        public void ConstructorWithNullContributorTest()
        {
            Assert.Throws<ArgumentNullException>(() => new EpubMetadataSource(null!, ID));
        }

        [Fact(DisplayName = "Constructing a EpubMetadataSource instance with null id parameter should succeed")]
        public void ConstructorWithNullIdTest()
        {
            EpubMetadataSource epubMetadataSource = new(SOURCE, null);
            Assert.Equal(SOURCE, epubMetadataSource.Source);
            Assert.Null(epubMetadataSource.Id);
        }
    }
}