Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
0
        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();
            }
        }
Ejemplo n.º 7
0
        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();
            }
        }
Ejemplo n.º 8
0
        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();
            }
        }
Ejemplo n.º 9
0
        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();
            }
        }
Ejemplo n.º 10
0
        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();
            }
        }
Ejemplo n.º 11
0
        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();
            }
        }
Ejemplo n.º 12
0
        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();
            }
        }
Ejemplo n.º 13
0
        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();
            }
        }
Ejemplo n.º 14
0
        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();
            }
        }
Ejemplo n.º 15
0
        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();
            }
        }
Ejemplo n.º 16
0
        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();
            }
        }
Ejemplo n.º 17
0
        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();
            }
        }
Ejemplo n.º 18
0
        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();
            }
        }
Ejemplo n.º 19
0
        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();
            }
        }