public void PutWithOverwriteTrue_UNCPathValidUser_File_Present_FileInStream() { Dev2CRUDOperationTO opTO = new Dev2CRUDOperationTO(true); string tmp = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + ".test"; string tmp2 = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + ".test"; PathIOTestingUtils.CreateAuthedUNCPath(tmp, false, _inDomain); IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(tmp, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password); IActivityIOPath src = ActivityIOFactory.CreatePathFromString(tmp2, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password); IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst); Stream stream = new MemoryStream(File.ReadAllBytes(_tmpfile1)); var directoryInfo = new FileInfo(src.Path).Directory; if (directoryInfo != null) { int len = FileSystemPro.Put(stream, dst, opTO, directoryInfo.ToString(), new List <string>()); stream.Close(); PathIOTestingUtils.DeleteAuthedUNCPath(tmp); PathIOTestingUtils.DeleteAuthedUNCPath(tmp2); Assert.IsTrue(len > 0); } else { Assert.Fail(); } }
public void CreateDirectoryUNCValidUser_WithOverwriteTrue_NotPresent_DirectoryCreated() { Dev2CRUDOperationTO opTO = new Dev2CRUDOperationTO(true); string basePath = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid(); IActivityIOPath path = ActivityIOFactory.CreatePathFromString(basePath, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password); IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path); bool result = FileSystemPro.CreateDirectory(path, opTO); PathIOTestingUtils.DeleteAuthedUNCPath(basePath, _inDomain); Assert.IsTrue(result); }
public void ListDirectoryUNC_ValidUserStarDotStar_With_NoContents_Expected_EmptyListReturned() { string basePath = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid(); PathIOTestingUtils.CreateAuthedUNCPath(basePath, true, _inDomain); IActivityIOPath path = ActivityIOFactory.CreatePathFromString(basePath + "\\*.*", (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password); IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path); IList <IActivityIOPath> result = FileSystemPro.ListDirectory(path); PathIOTestingUtils.DeleteAuthedUNCPath(basePath, _inDomain); Assert.IsTrue(result.Count == 0); }
public void DeleteUNCValidUserWith_FilePresent_Expected_DeleteSuccesful() { string tmp = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + ".test"; PathIOTestingUtils.CreateAuthedUNCPath(tmp, false, _inDomain); IActivityIOPath path = ActivityIOFactory.CreatePathFromString(tmp, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password); IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path); bool ok = FileSystemPro.Delete(path); PathIOTestingUtils.DeleteAuthedUNCPath(tmp); Assert.IsTrue(ok); }
public void PutWithOverwriteTrue_UNCPathValidUser_FileNot_Present_Expected_NewFileCreated() { Dev2CRUDOperationTO opTO = new Dev2CRUDOperationTO(true); string tmp = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + ".test"; IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(tmp, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password); IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst); Stream stream = new MemoryStream(File.ReadAllBytes(_tmpfile1)); int len = FileSystemPro.Put(stream, dst, opTO, null, new List <string>()); stream.Close(); PathIOTestingUtils.DeleteAuthedUNCPath(tmp); Assert.IsTrue(len > 0); }
public void ListDirectoryUNC_ValidUserStar_With_Contents_Expected_AllDirectoriesListFromUNCPath() { string basePath = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid(); PathIOTestingUtils.CreateAuthedUNCPath(basePath, true, _inDomain); string uncFile1 = basePath + "\\1.testfile"; string uncFile2 = basePath + "\\2.testfile"; PathIOTestingUtils.CreateAuthedUNCPath(uncFile1, false, _inDomain); PathIOTestingUtils.CreateAuthedUNCPath(uncFile2, false, _inDomain); IActivityIOPath path = ActivityIOFactory.CreatePathFromString(basePath + "\\*.testfile", (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password); IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path); IList <IActivityIOPath> result = FileSystemPro.ListDirectory(path); PathIOTestingUtils.DeleteAuthedUNCPath(basePath, _inDomain); Assert.IsTrue(result.Count == 2); }
public void GetWithUserName_UNCValidPath_Expected_Stream() { string uncPath = TestResource.PathOperations_UNC_Path + "Secure\\" + Guid.NewGuid() + ".test"; PathIOTestingUtils.CreateAuthedUNCPath(uncPath, false, _inDomain); IActivityIOPath path = ActivityIOFactory.CreatePathFromString(uncPath, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password); IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path); Stream result = FileSystemPro.Get(path, new List <string>()); int len = (int)result.Length; result.Close(); PathIOTestingUtils.DeleteAuthedUNCPath(uncPath); Assert.IsTrue(len > 0); }
public void GetWithInvalidUserName_UNCPath_Expected_NoStream() { string uncPath = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + ".test"; PathIOTestingUtils.CreateAuthedUNCPath(uncPath, false, _inDomain); IActivityIOPath path = ActivityIOFactory.CreatePathFromString(uncPath, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username + "abc", TestResource.PathOperations_Correct_Password); IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path); try { Stream result = FileSystemPro.Get(path, new List <string>()); result.Close(); PathIOTestingUtils.DeleteAuthedUNCPath(uncPath); Assert.Fail(); } catch (Exception) { PathIOTestingUtils.DeleteAuthedUNCPath(uncPath); Assert.IsTrue(true); } }