Exemple #1
0
 public void Setup()
 {
     // ArticleList.GetDefaultList();
     // sort by name1 : 10th article/11th article/12th article/1st article/2nd article/3rd article/4th article/5th article/6th article/7th article/8th article/9th article
     // sort by supref : sup1 ref 1/sup1 ref 2/sup2 ref 1/sup2 ref 2/sup3 ref 1/sup3 ref 2/sup4 ref 1/sup4 ref 2/sup5 ref 1/sup5 ref 2/sup6 ref 1/sup6 ref 2
     _readOnlyArticleRepository = new ReadOnlyArticleRepository(TestReadOnlyContext);
 }
        public async Task GetArticleByIdAsync_WithNonExistingId_ReturnsNull()
        {
            //Arrange
            var readOnlyArticleRepository = new ReadOnlyArticleRepository(TestReadOnlyContext);

            //Act
            var result = await readOnlyArticleRepository.GetArticleByIdAsync(99);

            //Assert
            Assert.That(result, Is.Null);
        }
        public async Task GetArticleByIdAsync_WithExistingId_ReturnsArticle()
        {
            //Arrange
            var readOnlyArticleRepository = new ReadOnlyArticleRepository(TestReadOnlyContext);

            //Act
            var result = await readOnlyArticleRepository.GetArticleByIdAsync(3);

            //Assert
            Assert.That(result.GetType(), Is.EqualTo(typeof(Article)));
            Assert.That(result.Photos.GetType(), Is.EqualTo(typeof(List <ArticlePhoto>)));
            Assert.That(result.Code, Is.EqualTo("Article03"));
        }