public void ShouldRunFileSystemSyncWhenStarted() { //Arrange var isOnRunStartRaised = false; var isRunCompleteRaised = false; var syncInfo = new FsSyncInfo {Source = "A", Target = "B"}; var oneWaySynchronizerMock = new Mock<IOneWaySynchronizer>(); oneWaySynchronizerMock.Setup(x => x.Run(syncInfo)); //Act var fileSystemSyncWhenStartup = new FileSystemSyncWhenStartup(oneWaySynchronizerMock.Object) { Name = "TestWhenStarted", SyncInfo = syncInfo }; fileSystemSyncWhenStartup.OnRunStart += name => { isOnRunStartRaised = true; }; fileSystemSyncWhenStartup.OnRunComplete += name => { isRunCompleteRaised = true; }; fileSystemSyncWhenStartup.Start(); //Assert Assert.IsTrue(isOnRunStartRaised); Assert.IsTrue(isRunCompleteRaised); oneWaySynchronizerMock.Verify(x => x.Run(syncInfo)); }
private static void ShouldRunFileSystemThrowExceptionSyncWhenSyncInfoIsNotCorrectly(SyncInfo syncInfo) { //Arrange var oneWaySynchronizerMock = new Mock<IOneWaySynchronizer>(); //Act var fileSystemSyncWhenStartup = new FileSystemSyncWhenStartup(oneWaySynchronizerMock.Object) { Name = "TestWhenStarted", SyncInfo = syncInfo }; fileSystemSyncWhenStartup.Start(); //Assert Assert.Fail("The SyncInfoIsNotCorrectlySet exception should have been thrown"); }