public void Class_NotSelectsFolderOnEvent_GivenFile() { //Arrange Checker checker = new Checker(); Validator validator = new Validator(true, checker); FileModifier fileMod = new FileModifier(checker); ISyncFolderPair pair = new MockClasses.SyncedPair(); ISyncedFolder syncedFolder = new FolderSync.FileSystem.Listening.SyncedFolder(pair, validator, fileMod); string tempPath = MethodBase.GetCurrentMethod().Name; string expected = "ModifyFolder"; //Act using (FileStream fs = File.Create(tempPath)) { fs.Close(); } string actual = checker.Message; File.Delete(tempPath); //Assert Assert.AreNotEqual(expected, actual); }
public void SyncFolder_ChecksValidation_GivenValidator() { //Arrange Checker checker = new Checker(); Validator validator = new Validator(true, checker); FileModifier fileMod = new FileModifier(new Checker()); ISyncFolderPair pair = new MockClasses.SyncedPair(); ISyncedFolder syncedFolder = new FolderSync.FileSystem.Listening.SyncedFolder(pair, validator, fileMod); string expected = "Valid"; //Act syncedFolder.SyncFolder(syncedFolder.LocalPath, UpdateType.Change); string actual = checker.Message; //Assert Assert.AreEqual(expected, actual); }
public void Class_NotSelectsFileOnEvent_GivenFolder() { //Arrange Checker checker = new Checker(); Validator validator = new Validator(true, checker); FileModifier fileMod = new FileModifier(checker); ISyncFolderPair pair = new MockClasses.SyncedPair(); ISyncedFolder syncedFolder = new FolderSync.FileSystem.Listening.SyncedFolder(pair, validator, fileMod); string tempPath = MethodBase.GetCurrentMethod().Name; string expected = "ModifyFile"; //Act DirectoryInfo info = Directory.CreateDirectory(tempPath); Thread.Sleep(1); string actual = checker.Message; Directory.Delete(info.FullName); //Assert Assert.AreNotEqual(expected, actual); }