// * - Attempt to Remove again should succeed, e.g., nothing happens. bool test7(Configure config) { Logger.add(" test7: attempt to remove already removed directory").showCurrentItem(); Assert(dest == "c:/temp/test/configure"); config.Remove(); if (Directory.Exists(dest)) { return(false); } return(true); }
// * - Repeat without calling Remove, so that configure has some files. // * Should succeed with same files as source. bool test5(Configure config) { Logger.add(" test5: Repeat test4 without Removing configured directory").showCurrentItem(); Assert(dest == "c:/temp/test/configure"); Assert(src == "c:/test/source"); config.Destination(dest); config.Copy(src); if (config.NumberOfCopyableFiles(src) != Directory.GetFiles(dest).Length) { return(false); } return(true); }
// * - Attempt to configure C:/temp/test/configure, using files from // * source should succeed, with the same files as in source. bool test4(Configure config) { Logger.add(" test4: attempt to configure with non-empty directory").showCurrentItem(); Assert(dest == "c:/temp/test/configure"); config.Destination(dest); src = "c:/test/source"; config.Copy(src); if (config.NumberOfCopyableFiles(src) != Directory.GetFiles(dest).Length) { return(false); } return(true); }
//----< define tests >------------------------------------- // * - Set Root to C:/temp/test. // * - Attempt to configure on C:/temp/foobar should throw. bool test1(Configure config) { Logger.add(" test1: attempt to configure on illegal path").showCurrentItem(); config.SetRoot("c:/temp/test"); try { config.Destination("c:/temp/foobar"); return(false); } catch (Exception ex) { Logger.add(" " + ex.Message.Trim()).showCurrentItem(); } return(true); }
// * - Attempt to configure C:/temp/test/configure from empty should // * succeed in that configure is created, but has no files. bool test2(Configure config) { Logger.add(" test2: attempt to configure and copy path with no files").showCurrentItem(); dest = "c:/temp/test/configure"; src = "c:/test/empty"; config.Destination(dest); if (!Directory.Exists(dest)) { return(false); } config.Copy(src); if (Directory.GetFiles(dest).Length != 0) { return(false); } return(true); }