public static void Execute(this CopyFileCommand copyFileCommand, ICommandAdapter adapter, TestParameters testParameters, string sourceFile, string destinationFile) { var sourceParameter = new Parameter("Source", sourceFile, true, new PositionInScript(0)); var destinationParameter = new Parameter("Destination", destinationFile, true, new PositionInScript(0)); copyFileCommand.ParseCommand(testParameters, sourceParameter, destinationParameter); copyFileCommand.Execute(adapter); }
private void CopyModel(ICommandAdapter adapter, string binPath, string model, string modelFile) { var copyFileCommand = new CopyFileCommand(); string destinationFile = Path.Combine(binPath, model); var deleteFileCommand = new DeleteFileCommand(); deleteFileCommand.Parameters.MainParameter = new MainParameter(destinationFile); deleteFileCommand.Execute(adapter); copyFileCommand.Execute(adapter, _testParameters, modelFile, destinationFile); if (this.ParameterValue <ModelOperation>(Operation) != ModelOperation.None) { var actionCommand = new ActionCommand(); actionCommand.DoAction(adapter, "Parameter", Path.GetFileNameWithoutExtension(model)); actionCommand.DoAction(adapter, "EasyTestAction", this.ParameterValue <ModelOperation>(Operation).ToString()); } }
private void CopyModel(ICommandAdapter adapter, string binPath, string model, string modelFile){ var copyFileCommand = new CopyFileCommand(); string destinationFile = Path.Combine(binPath, model); var deleteFileCommand = new DeleteFileCommand(); deleteFileCommand.Parameters.MainParameter = new MainParameter(destinationFile); deleteFileCommand.Execute(adapter); copyFileCommand.Execute(adapter, _testParameters, modelFile, destinationFile); if (this.ParameterValue<bool>(IsExternalModel)){ var actionCommand = new ActionCommand(); actionCommand.Parameters.MainParameter = new MainParameter("Parameter"); actionCommand.Parameters.ExtraParameter = new MainParameter(Path.GetFileNameWithoutExtension(model)); actionCommand.Execute(adapter); actionCommand = new ActionCommand(); actionCommand.Parameters.MainParameter = new MainParameter("Action"); actionCommand.Parameters.ExtraParameter=new MainParameter("LoadModel"); actionCommand.Execute(adapter); } }
public static void InvokeCommand() { IAccessible file = new Archive(); ICommand fileClose = new CloseFileCommand(file); ICommand fileOpen = new OpenFileCommand(file); ICommand fileCopy = new CopyFileCommand(file); ICommand filePaste = new PasteFileCommand(file); Access command = new Access(fileClose, fileOpen, fileCopy, filePaste); string [] orders = { "close", "open", "close", "close", "copy", "paste", "paste", "batata" }; foreach (string ordem in orders) { switch (ordem) { case "open": Console.Write("Comando " + ordem + ": "); command.Open(); break; case "close": Console.Write("Comando " + ordem + ": "); command.Close(); break; case "copy": Console.Write("Comando " + ordem + ": "); command.Copy(); break; case "paste": Console.Write("Comando " + ordem + ": "); command.Paste(); break; default: Console.WriteLine("Comando " + ordem + ": Comando Inválido"); break; } } Console.ReadLine(); }
private void CopyModel(ICommandAdapter adapter, TestAlias testAlias, string model, string modelFile) { var copyFileCommand = new CopyFileCommand(); string path1 = testAlias.Value; string destinationFile = Path.Combine(path1, model); var deleteFileCommand = new DeleteFileCommand(); deleteFileCommand.Parameters.MainParameter = new MainParameter(destinationFile); deleteFileCommand.Execute(adapter); copyFileCommand.Execute(adapter, _testParameters, modelFile, destinationFile); if (this.ParameterValue <bool>(IsExternalModel)) { var actionCommand = new ActionCommand(); actionCommand.Parameters.MainParameter = new MainParameter("Parameter"); actionCommand.Parameters.ExtraParameter = new MainParameter(Path.GetFileNameWithoutExtension(model)); actionCommand.Execute(adapter); actionCommand = new ActionCommand(); actionCommand.Parameters.MainParameter = new MainParameter("Action"); actionCommand.Parameters.ExtraParameter = new MainParameter("LoadModel"); actionCommand.Execute(adapter); } }
public void TestCopy() { var tfc = new TempFileCollection(); var srcFileName = tfc.AddExtension("tmp1"); var destFileName = tfc.AddExtension("tmp2"); var fileManager = new FileManager(); var createCommand = new CreateRandomFileCommand(fileManager, srcFileName); var copyCommand = new CopyFileCommand(fileManager, srcFileName, destFileName); var invoker = new Invoker(); invoker.Execute(createCommand); invoker.Execute(copyCommand); using (StreamReader srcReader = File.OpenText(srcFileName), destReader = File.OpenText(destFileName)) { var srcContent = srcReader.ReadToEnd(); var destContent = destReader.ReadToEnd(); Assert.AreEqual(srcContent, destContent); } }