public async Task AllHomeNewsAsyncShouldRerutnCorectedOrderedNewsArticles() { //Arrange var dbOptions = new DbContextOptionsBuilder <UndergroundStationDbContext>() .UseInMemoryDatabase("UndergroundStationTestDb") .Options; var db = new UndergroundStationDbContext(dbOptions); var newsService = new NewsService(db); var firstNewsArticle = new NewsArticle { Id = 1, Title = "First Article", PublishedDate = DateTime.UtcNow.AddDays(-1), ArticleType = ArticleType.Interviews }; var secondNewsArticle = new NewsArticle { Id = 2, Title = "Second Article", PublishedDate = DateTime.UtcNow.AddHours(1), ArticleType = ArticleType.Interviews }; var thirdNewsArticle = new NewsArticle { Id = 3, Title = " Third Article", PublishedDate = DateTime.UtcNow, ArticleType = ArticleType.History }; db.AddRange(firstNewsArticle, secondNewsArticle, thirdNewsArticle); await db.SaveChangesAsync(); //Act var result = await newsService.AllHomeNewsAsync(); //Assert result .Should() .Match (r => r.ElementAt(0).Id == 2 && r.ElementAt(1).Id == 3 && r.ElementAt(2).Id == 1) .And .HaveCount(3); }