public void GetAllOrderedByDate_ReturnsItemsInCorrectOrder() { // Arrange var context = this.ServiceProvider.GetRequiredService <WmipDbContext>(); var article1 = new Article { Id = 1, Title = "ar1", User = new User { UserName = "******" }, Ratings = new List <Rating>() }; var article2 = new Article { Id = 2, Title = "art2", User = new User { UserName = "******" }, Ratings = new List <Rating>() }; var article3 = new Article { Id = 3, Title = "art3", User = new User { UserName = "******" }, Ratings = new List <Rating>() }; context.Articles.AddRange(article1, article2, article3); context.SaveChanges(); var articlesService = new ArticlesService(context); // Act var result = articlesService.GetAllOrderedByDate("aaa").ToList(); //Assert Assert.Equal(3, result.Count); }