public async Task ByThemeIdAsyncShouldReturnCorrectAnswerAndOrderCorrectly() { //Arrange var dbOptions = new DbContextOptionsBuilder <UndergroundStationDbContext>() .UseInMemoryDatabase("UndergroundStationTestDb") .Options; var db = new UndergroundStationDbContext(dbOptions); var articleService = new ArticleService(db); var firstArticle = new ForumArticle { Id = 2, PublishedDate = DateTime.UtcNow, ForumThemeId = 1 }; var secondArticle = new ForumArticle { Id = 3, PublishedDate = DateTime.UtcNow.AddDays(-1), ForumThemeId = 1 }; var thirdArticle = new ForumArticle { Id = 4, PublishedDate = DateTime.UtcNow, ForumThemeId = 2 }; db.AddRange(firstArticle, secondArticle, thirdArticle); await db.SaveChangesAsync(); //Act var result = await articleService.ByThemeIdAsync(1, 1); //Assert result .Should() .Match (r => r.ElementAt(0).Id == 3 && r.ElementAt(1).Id == 2) .And .HaveCount(2); }