public void Test1() { ShowdirCommand commandOne = new ShowdirCommand(); ShowdiskCommand commandTwo = new ShowdiskCommand(); DirectoryCommand commandThree = new DirectoryCommand(); StartAppCommand commandFour = new StartAppCommand(); DeleteFileCommand commandFive = new DeleteFileCommand(); UploadFileCommand commandSix = new UploadFileCommand(); ChangeDirCommand commandSeven = new ChangeDirCommand(); DownloadFileCommand commandEight = new DownloadFileCommand(); List <ICommand> container = new List <ICommand>(); container.Add(commandOne); container.Add(commandTwo); container.Add(commandThree); container.Add(commandFour); container.Add(commandFive); container.Add(commandSix); container.Add(commandSeven); container.Add(commandEight); foreach (var value in container) { bool finders = false; foreach (var value2 in _macroCommand._commands) { if (value2.GetType() == value.GetType()) { finders = true; } } Assert.True(finders); } }
public static ToolStripMenuItem OpenApp() { var path = Util.Reg.GetExePath(); var cmd = new DirectoryCommand() { Name = Env.OpenAppText, Command = path, }; return(cmd.ToMenuItem(Path.GetDirectoryName(path))); }
public void ExistsTest() { var tempPath = GetTempPath(@"SsisUnitTests\", true); var target = new DirectoryCommand(_testSuite) { Operation = DirectoryOperation.Exists, Argument1 = tempPath }; object actual = target.Execute(); Assert.AreEqual(true, actual); }
public void DeleteTest() { var tempPath = GetTempPath("DeleteMe", true); var target = new DirectoryCommand(_testSuite) { Operation = DirectoryOperation.Delete, Argument1 = tempPath }; object actual = target.Execute(); Assert.AreEqual(0, actual); }
public void DoesntExistTest() { var tempPath = GetTempPath("DoesntExist"); var target = new DirectoryCommand(_testSuite) { Operation = DirectoryOperation.Exists, Argument1 = tempPath }; object actual = target.Execute(); Assert.AreEqual(false, actual); }
public void MoveTest() { var fromPath = GetTempPath(@"MoveFromTest", true); var toPath = GetTempPath(@"MoveToTest"); var target = new DirectoryCommand(_testSuite) { Operation = DirectoryOperation.Move, Argument1 = fromPath, Argument2 = toPath }; object actual = target.Execute(); Assert.AreEqual(0, actual); }
public static ToolStripMenuItem GetCreateDirecotyCommandFileMenuItem(string path) { var item = new ToolStripMenuItem(Env.CreateFolderSpecificFileText); item.Click += (sender, args) => { var o = new DirectoryCommand[] { new DirectoryCommand() { Name = "Custom Command", Command = "cmd" }, }; Yaml.SaveYaml(path, o); File.SetAttributes(path, FileAttributes.Hidden); }; item.Image = NativeLoader.GetShell32Icon(70); return(item); }
public void FileCountTest() { var tempPath = GetTempPath("FileCount", true); CreateTempFile(tempPath, "test1.aaa"); CreateTempFile(tempPath, "test2.aaa"); CreateTempFile(tempPath, "test3.aaa"); var target = new DirectoryCommand(_testSuite) { Operation = DirectoryOperation.FileCount, Argument1 = tempPath, Argument2 = "*.aaa" }; object actual = target.Execute(); Assert.AreEqual(3, actual); }
public void MoveWithoutTargetTest() { var fromPath = GetTempPath(@"MoveFromTest"); var target = new DirectoryCommand(_testSuite) { Operation = DirectoryOperation.Move, Argument1 = fromPath }; try { target.Execute(); Assert.Fail("Method did not throw the expected ArgumentException."); } catch (ArgumentException) { Assert.IsTrue(true); } }
private static void On(DirectoryCommand command) { foreach (var file in fileSystem.Directory()) WriteSuccessLine(file); }
public override bool TryBuildCommand(string[] args, out object command) { command = new DirectoryCommand(); return true; }
public void Setup() { DirectoryCommand directoryCommand = new DirectoryCommand(); _directoryCommand = directoryCommand; }