public void TestGetFolderNames() { { // when BusinessesFolder.Initialize("xxx"); List <string> names = BusinessesFolder.GetFolderNames().ToList(); // then names.Sort(); Assert.AreEqual(3, names.Count); Assert.AreEqual("Check-job-status", names[0]); Assert.AreEqual("Time-keeping", names[1]); Assert.AreEqual("xxx", names[2]); } { // when BusinessesFolder.SetupFolderIfNotExists("zzz"); List <string> names = BusinessesFolder.GetFolderNames().ToList(); // then names.Sort(); Assert.AreEqual(4, names.Count); Assert.AreEqual("Check-job-status", names[0]); Assert.AreEqual("Time-keeping", names[1]); Assert.AreEqual("xxx", names[2]); Assert.AreEqual("zzz", names[3]); } }
public void TestSetupFolderIfNotExists() { { // setup BusinessesFolder.Initialize("abc"); string folder = BusinessesFolder.GetFolder("def"); Assert.IsFalse(Directory.Exists(folder)); // when BusinessesFolder.SetupFolderIfNotExists("def"); // then Assert.IsTrue(Directory.Exists(folder)); } { // setup BusinessesFolder.Initialize("abc"); string mainPs1 = Path.Combine(BusinessesFolder.GetFolder("abc"), "main.ps1"); Assert.IsTrue(File.Exists(mainPs1)); File.Delete(mainPs1); Assert.IsFalse(File.Exists(mainPs1)); // when BusinessesFolder.SetupFolderIfNotExists("abc"); // then Assert.IsFalse(File.Exists(mainPs1)); } }