private FunctionResult Execute(V2.DirectoryOperationsShared.ActionType action, string sourceDirectoryPath = null, string targetDirectoryPath = null, V2.DirectoryOperationsShared.ExistsOption existsOption = V2.DirectoryOperationsShared.ExistsOption.DoNothing, V2.DirectoryOperationsShared.CreateExistsOption createExistsOption = V2.DirectoryOperationsShared.CreateExistsOption.DoNothing, string directory = null, bool replaceIfFileExist = false) { FunctionExecutor tester = (new FunctionTester <DirectoryOperations>()).Compile( new PropertyValue(DirectoryOperationsShared.ActionPropertyName, action), new PropertyValue(DirectoryOperationsShared.ReplaceExistingFilePropertyName, replaceIfFileExist), new PropertyValue(DirectoryOperationsShared.DirectoryExistsPropertyName, existsOption), new PropertyValue(DirectoryOperationsShared.CreateDirectoryExistsPropertyName, createExistsOption)); return(tester.Execute( new ParameterValue(DirectoryOperationsShared.SourceDirectoryPropertyName, sourceDirectoryPath), new ParameterValue(DirectoryOperationsShared.TargetDirectoryPropertyName, targetDirectoryPath), new ParameterValue(DirectoryOperationsShared.DirectoryPropertyName, directory))); }
public void TestExecuteWithActionCreateWhenDirectoryDoesNotExist( [Values( V2.DirectoryOperationsShared.CreateExistsOption.DoNothing, V2.DirectoryOperationsShared.CreateExistsOption.IncrementFolderName, V2.DirectoryOperationsShared.CreateExistsOption.Clear, V2.DirectoryOperationsShared.CreateExistsOption.ThrowException)] V2.DirectoryOperationsShared.CreateExistsOption existsOption) { string folder = Path.Combine(fixtureBaseFolderPath, "very", "deep"); Assert.IsFalse(Directory.Exists(folder)); FunctionResult result = Execute(V2.DirectoryOperationsShared.ActionType.Create, createExistsOption: existsOption, directory: folder); Assert.AreEqual(folder, result.Value); Assert.IsTrue(Directory.Exists(folder)); }