public void LockAndUnlockFileTest() { P4Service target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, new Map()); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(settings.WorkspacePath); string message; bool result = target.AddAndSubmitFile(filePath, out message); Assert.IsTrue(result, "AddAndSubmitFile error: " + message); result = target.EditFile(filePath, out message); Assert.IsTrue(result, "EditFile should have succeeded: " + message); result = target.LockFile(filePath, out message); Assert.IsTrue(result, "LockFile should have succeeded: " + message); result = target.UnlockFile(filePath, out message); Assert.IsTrue(result, "UnlockFile should have succeeded: " + message); target.Disconnect(); target.Dispose(); } }
public void MoveFileTest() { var target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(); string message; bool result = target.AddAndSubmitFile(filePath, out message); Assert.IsTrue(result, "AddAndSubmitFile error: " + message); result = target.EditFile(filePath, out message); Assert.IsTrue(result, "EditFile should have succeeded: " + message); string fileName = Path.GetRandomFileName(); string newPath = Path.Combine(settings.WorkspacePath, fileName); result = target.MoveFile(filePath, newPath, out message); Assert.IsTrue(result, "MoveFile should have succeeded: " + message); target.Disconnect(); target.Dispose(); } }
public void IsOpenForDeleteTest() { var target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(); string message; bool result = target.AddAndSubmitFile(filePath, out message); Assert.IsTrue(result, "AddAndSubmitFile error: " + message); result = target.DeleteFile(filePath, out message); Assert.IsTrue(result, "DeleteFile should have succeeded: " + message); FileState state = target.GetVsFileState(filePath, out message); Assert.AreEqual(state, FileState.OpenForDelete, "Should have been OpenForDelete: " + message); target.Disconnect(); target.Dispose(); } }
public void IsOpenForDeleteTest() { P4Service target = new P4Service(SERVER, USER, PASSWORD, WORKSPACE, false, null, new Map()); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(TESTPATH); string message; bool result = target.AddAndSubmitFile(filePath, out message); Assert.IsTrue(result, "AddAndSubmitFile error: " + message); result = target.DeleteFile(filePath, out message); Assert.IsTrue(result, "DeleteFile should have succeeded: " + message); FileState state = target.GetVsFileState(filePath, out message); Assert.AreEqual(state, FileState.OpenForDelete, "Should have been OpenForDelete: " + message); target.Disconnect(); target.Dispose(); } }
public void MoveFileTest() { P4Service target = new P4Service(SERVER, USER, PASSWORD, WORKSPACE, false, null, new Map()); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(TESTPATH); string message; bool result = target.AddAndSubmitFile(filePath, out message); Assert.IsTrue(result, "AddAndSubmitFile error: " + message); result = target.EditFile(filePath, out message); Assert.IsTrue(result, "EditFile should have succeeded: " + message); string fileName = Path.GetRandomFileName(); string newPath = Path.Combine(TESTPATH, fileName); result = target.MoveFile(filePath, newPath, out message); Assert.IsTrue(result, "MoveFile should have succeeded: " + message); target.Disconnect(); target.Dispose(); } }
public void RevertIfUnchangedFileTest() { _map = new Map(); P4Service target = new P4Service(SERVER, USER, PASSWORD, WORKSPACE, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(TESTPATH); string message; bool result = target.AddAndSubmitFile(filePath, out message); Assert.IsTrue(result, "AddAndSubmitFileTest error: " + message); result = target.EditFile(filePath, out message); Assert.IsTrue(result, "EditFile should have succeeded: " + message); result = target.RevertIfUnchangedFile(filePath, out message); Assert.IsTrue(result, "RevertIfUnchangedFile should have succeeded: " + message); target.Disconnect(); target.Dispose(); } }
public void DeleteFileTest() { _map = new Map(); P4Service target = new P4Service(SERVER, USER, PASSWORD, WORKSPACE, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(TESTPATH); if (File.Exists(filePath)) { File.Delete(filePath); } string message; bool result = target.DeleteFile(filePath, out message); Assert.IsTrue(result, "DeleteFile should have succeeded with warning. message: " + message); target.Disconnect(); target.Dispose(); } }
public void IsOpenForAddTest() { P4Service target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, new Map()); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(settings.WorkspacePath); string message; bool result = target.AddFile(filePath, out message); Assert.IsTrue(result, "AddFileTest error: " + message); FileState state = target.GetVsFileState(filePath, out message); Assert.AreEqual(state, FileState.OpenForAdd, "Should have been OpenForAdd: " + message); target.Disconnect(); target.Dispose(); } }
public void DeleteEditedFileTest() { var target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(); string message; bool result = target.AddAndSubmitFile(filePath, out message); Assert.IsTrue(result, "AddAndSubmitFile error: " + message); result = target.EditFile(filePath, out message); Assert.IsTrue(result, "EditFile should have succeeded: " + message); result = target.DeleteFile(filePath, out message); Assert.IsFalse(result, "DeleteFile should have failed: " + message); //var state = target.GetP4FileState(filePath, out message); //Assert.IsTrue(state == FileState.DeletedAtHeadRevision, "P4 File State should be DeletedAtHeadRevision"); target.Disconnect(); target.Dispose(); } }
public void DeleteFileTest() { _map = new Map(); P4Service target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(settings.WorkspacePath); if (File.Exists(filePath)) { File.Delete(filePath); } string message; bool result = target.DeleteFile(filePath, out message); Assert.IsTrue(result, "DeleteFile should have succeeded with warning. message: " + message); target.Disconnect(); target.Dispose(); } }
public void ConnectWithBadPortTest() { P4Service target = new P4Service("A_BAD_PORT", USER, PASSWORD, WORKSPACE, false, null, new Map()); try { target.Connect(); } finally { target.Disconnect(); target.Dispose(); } }
public void ConnectWithBadWorkspaceTest() { P4Service target = new P4Service(SERVER, USER, PASSWORD, "A_BAD_WORKSPACE", false, null, new Map()); try { target.Connect(); } finally { target.Disconnect(); target.Dispose(); } }
public void ConnectWithBadWorkspaceTest() { var target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, "A_BAD_WORKSPACE", false, null, _map); try { target.Connect(); } finally { target.Disconnect(); target.Dispose(); } }
public void ConnectWithBadPortTest() { var target = new P4Service("A_BAD_PORT", settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, _map); try { target.Connect(); } finally { target.Disconnect(); target.Dispose(); } }
public void ConnectDisconnectTest() { var target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "P4Service cannot connect"); target.Disconnect(); Assert.IsFalse(target.IsConnected, "P4Service cannot disconnect"); target.Dispose(); } }
public void ConnectDisconnectTest() { _map = new Map(); P4Service target = new P4Service(SERVER, USER, PASSWORD, WORKSPACE, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "P4Service cannot connect"); target.Disconnect(); Assert.IsFalse(target.IsConnected, "P4Service cannot disconnect"); target.Dispose(); } }
public void AddFileTest() { var target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(); string message; bool result = target.AddFile(filePath, out message); Assert.IsTrue(result, "AddFileTest error: " + message); target.Disconnect(); target.Dispose(); } }
public void IsNotInPerforceTest() { P4Service target = new P4Service(SERVER, USER, PASSWORD, WORKSPACE, false, null, new Map()); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(TESTPATH); string message; FileState state = target.GetVsFileState(filePath, out message); Assert.AreEqual(state, FileState.NotInPerforce, "Should have been NotInPerforce: " + message); target.Disconnect(); target.Dispose(); } }
public void IsNotInPerforceTest() { var target = new P4Service(settings.PerforceServer, settings.PerforceUser, PASSWORD, settings.PerforceWorkspace, false, null, _map); try { target.Connect(); } finally { Assert.IsTrue(target.IsConnected, "Unable to connect"); string filePath = GetTempFileName(); string message; FileState state = target.GetVsFileState(filePath, out message); Assert.AreEqual(state, FileState.NotInPerforce, "Should have been NotInPerforce: " + message); target.Disconnect(); target.Dispose(); } }