public void ShouldSaveEndDateWhenHandlerPassed() { store.SetupProperty(s => s.LastScanEndDate); reader.Setup(r => r.GetFlattenedEntries(It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>())) .Returns(new List <CatalogEntry>()); using (var invalidator = new CatalogInvalidator(logger, config, store.Object, reader.Object)) { invalidator.UpdatedEntry += (s, e) => { // ok }; invalidator.Run(); store.VerifySet(s => s.LastScanEndDate = It.IsAny <DateTimeOffset>(), Times.AtLeastOnce()); } }
public void ShouldNotSaveEndDateWhenHandlerFailed() { store.SetupProperty(s => s.LastScanEndDate); reader.Setup(r => r.GetFlattenedEntries(It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>())) .Returns(new List <CatalogEntry>()); using (var invalidator = new CatalogInvalidator(logger, config, store.Object, reader.Object)) { invalidator.UpdatedEntry += (s, e) => { throw new Exception("test error"); }; invalidator.Run(); store.VerifySet(s => s.LastScanEndDate = It.IsAny <DateTimeOffset>(), Times.Never()); } }