public void MarkShowTypesAsInvalid_Should_Invalidate_All_Statistics_With_Type_Show() { RunTest(() => { var statisticOne = new Statistic { Id = Guid.NewGuid(), Type = StatisticType.Show, CalculationDateTime = DateTime.Now.AddDays(-1), JsonResult = "", IsValid = false, CollectionIds = new string[0] }; var statisticTwo = new Statistic { Id = Guid.NewGuid(), Type = StatisticType.Show, CalculationDateTime = DateTime.Now, JsonResult = "", IsValid = true, CollectionIds = new string[0] }; var statisticThree = new Statistic { Id = Guid.NewGuid(), Type = StatisticType.Movie, CalculationDateTime = DateTime.Now.AddDays(1), JsonResult = "", IsValid = true, CollectionIds = new string[0] }; var statisticFour = new Statistic { Id = Guid.NewGuid(), Type = StatisticType.Show, CalculationDateTime = DateTime.Now.AddDays(2), JsonResult = "", IsValid = true, CollectionIds = new[] { "1" } }; using (var database = _context.LiteDatabase) { var collection = database.GetCollection <Statistic>(); collection.InsertBulk(new[] { statisticOne, statisticTwo, statisticThree, statisticFour }); var statistics = collection.FindAll().ToList(); statistics.Count.Should().Be(4); } _statisticsRepository.MarkShowTypesAsInvalid(); using (var database = _context.LiteDatabase) { var collection = database.GetCollection <Statistic>(); var statistics = collection.FindAll().OrderBy(x => x.CalculationDateTime).ToList(); statistics.Count.Should().Be(4); statistics.Count(x => x.Type == StatisticType.Show && !x.IsValid).Should().Be(3); statistics.Count(x => x.Type == StatisticType.Movie && x.IsValid).Should().Be(1); } }); }