public void FindArticleByIdShouldReturnNullWithUnexistingId() { // Arrange var db = Tests.GetDatabase(); var articleService = new ArticleService(db); var articleData = this.GetArticleData(); db.AddRange(articleData); db.SaveChanges(); // Act var result = articleService.ById(11); // Assert result .Should().BeNull(); }
public void FindArticleByIdShouldReturnTheCorrectResult() { // Arrange var db = Tests.GetDatabase(); var articleService = new ArticleService(db); var articleData = this.GetArticleData(); db.AddRange(articleData); db.SaveChanges(); // Act var result = articleService.ById(1); // Assert result.Title .Should().Be(ArticleTitle); result .Should().BeOfType <ArticlesDetailsServiceModel>(); }