Ejemplo n.º 1
0
        public void TestRename()
        {
            List <string> warnings = new List <string>();
            var           task     = CreateTfsTaskFromLocalProjectPath(TFSServerAddress, this.testProjectPath);

            task.WarningDialogDisplayed += (m) => warnings.Add(m);

            var pipe = CreateUnityConnectionPipe();

            pipe.SendMessageLine("c:move");
            pipe.SendMessageLine("2");
            pipe.SendMessageLine(ConvertToUnityPath(mainScenePath));
            pipe.SendMessageLine("0");
            pipe.SendMessageLine(ConvertToUnityPath(mainSceneMovedPath));
            pipe.SendMessageLine("0");
            pipe.SendMessageLine("c:shutdown");

            var sceneStatus = TfsFileStatus.CreateFromLocalPath(Workspace, mainScenePath);

            Assert.AreEqual(ChangeType.None, sceneStatus.LocalChangeType);

            task.Run();

            var sceneRenamedStatus = task.TfsFileStatusCache.Find(ConvertToUnityPath(mainSceneMovedPath));

            Assert.AreEqual(ChangeType.Rename | ChangeType.Lock, sceneRenamedStatus.LocalChangeType);

            Assert.AreEqual(0, warnings.Count);

            pipe.Close();
            task.Close();

            var pipeText = File.ReadAllText(mockNamedPipeName);
        }
Ejemplo n.º 2
0
        public void TestCheckoutFolders()
        {
            List <string> warnings = new List <string>();
            var           task     = CreateTfsTaskFromLocalProjectPath(TFSServerAddress, this.testProjectPath);

            task.WarningDialogDisplayed += (m) => warnings.Add(m);

            var pipe = CreateUnityConnectionPipe();

            pipe.SendMessageLine("c:checkout");
            pipe.SendMessageLine("2");
            pipe.SendMessageLine(ConvertToUnityPath(scenesFolderPath));
            pipe.SendMessageLine("3");
            pipe.SendMessageLine(ConvertToUnityPathAddMeta(scenesFolderPath));
            pipe.SendMessageLine("3");
            pipe.SendMessageLine("c:shutdown");

            //Check that the main scene got checked out
            var fileStatus = TfsFileStatus.CreateFromLocalPath(Workspace, mainScenePath);

            Assert.AreEqual(ChangeType.None, fileStatus.LocalChangeType);

            task.Run();

            fileStatus.RefreshExtendedItem(Workspace);
            Assert.AreEqual(ChangeType.Edit | ChangeType.Lock, fileStatus.LocalChangeType);

            Assert.AreEqual(0, warnings.Count);

            pipe.Close();
            task.Close();

            var pipeText = File.ReadAllText(mockNamedPipeName);
        }
Ejemplo n.º 3
0
        public void TestBinaryCheckoutWithRemoteCheckoutNolock()
        {
            List <string> warnings = new List <string>();
            var           task     = CreateTfsTaskFromLocalProjectPath(TFSServerAddress, this.testProjectPath);

            task.WarningDialogDisplayed += (m) => warnings.Add(m);

            var pipe = CreateUnityConnectionPipe();

            pipe.SendMessageLine("c:checkout");
            pipe.SendMessageLine("2");
            pipe.SendMessageLine(ConvertToUnityPath(mainScenePath));
            pipe.SendMessageLine("3");
            pipe.SendMessageLine(ConvertToUnityPathAddMeta(mainScenePath));
            pipe.SendMessageLine("3");
            pipe.SendMessageLine("c:shutdown");

            var sceneStatus = TfsFileStatus.CreateFromLocalPath(Workspace, mainScenePath);

            Assert.AreEqual(ChangeType.None, sceneStatus.LocalChangeType);

            Workspace2.PendEdit(new[] { mainScenePath2 }, RecursionType.None, null, LockLevel.None);

            task.Run();

            sceneStatus.RefreshExtendedItem(Workspace);
            Assert.AreEqual(ChangeType.None, sceneStatus.LocalChangeType);

            Assert.AreEqual(1, warnings.Count);

            pipe.Close();
            task.Close();

            var pipeText = File.ReadAllText(mockNamedPipeName);
        }
Ejemplo n.º 4
0
        public void TestDelete()
        {
            var task = CreateTfsTaskFromLocalProjectPath(TFSServerAddress, this.testProjectPath);

            var pipe = CreateUnityConnectionPipe();

            pipe.SendMessageLine("c:delete");
            pipe.SendMessageLine("2");
            pipe.SendMessageLine(ConvertToUnityPath(mainScenePath));
            pipe.SendMessageLine("3");
            pipe.SendMessageLine(ConvertToUnityPathAddMeta(mainScenePath));
            pipe.SendMessageLine("3");
            pipe.SendMessageLine("c:shutdown");

            var sceneStatus = TfsFileStatus.CreateFromLocalPath(Workspace, mainScenePath);

            Assert.AreEqual(ChangeType.None, sceneStatus.LocalChangeType);

            task.Run();

            sceneStatus.RefreshExtendedItem(Workspace);
            Assert.AreEqual(ChangeType.Delete | ChangeType.Lock, sceneStatus.LocalChangeType);


            var scenedeletedStatus = task.TfsFileStatusCache.Find(ConvertToUnityPath(mainScenePath));

            Assert.AreEqual(ChangeType.Delete | ChangeType.Lock, scenedeletedStatus.LocalChangeType);

            pipe.Close();
            task.Close();

            var pipeText = File.ReadAllText(mockNamedPipeName);
        }