public void Can_parse_response()
        {
        
            string response = @"Local information:
                  Local path : c:\dev\file.cs
                  Server path: $/Main/file.cs
                  Changeset  : 5
                  Change     : none
                  Type       : file
                Server information:
                  Server path  : $/Main/file.cs
                  Changeset    : 5
                  Deletion ID  : 0
                  Lock         : none
                  Lock owner   :
                  Last modified: 20 January 2014 11:22:27
                  Type         : file
                  File type    : utf-8
                  Size         : 578
                Local information:
                  Local path : c:\dev\file2.cs
                  Server path: $/Main/file2.cs
                  Changeset  : 5
                  Change     : none
                  Type       : file
                Server information:
                  Server path  : $/Main/file2.cs
                  Changeset    : 5
                  Deletion ID  : 0
                  Lock         : none
                  Lock owner   :
                  Last modified: 20 January 2014 11:22:27
                  Type         : file
                  File type    : utf-8
                  Size         : 988";

            var infoResponse = new InfoCommandResponse(response);

            Assert.That(infoResponse.LocalInformation.Count, Is.EqualTo(2));
        }
예제 #2
0
        private Dictionary<string, IItemInformation> GetItemInformation(IEnumerable<ITaskItem> files)
        {                        
            var client = new TfsClient();
            CopyBuildEngine(client);
            
            var success = false;
            var attempt = 0; const int retryCount = 3;
            
            while (!success && attempt < retryCount)
            {
                Log.LogMessage("Retrieving local file information to determine tfs source indexing attempt {0}", attempt + 1);           
                client.Command = "info";
                if (!string.IsNullOrEmpty(this.ChangesetVersion))
                {
                    client.ChangesetVersion = this.ChangesetVersion;
                }

                if (!string.IsNullOrEmpty(this.TeamProjectCollectionUri))
                {
                    client.Collection = this.TeamProjectCollectionUri;
                }

                client.Files = GetItemSpecs(files);
                client.WorkingDirectory = this.WorkspaceDirectory;
                success = client.Execute();
                attempt = attempt + 1;
            }

            Log.LogMessage("Success {0}, exit code {1} after {2} attempts.", success.ToString().ToLower(), client.ExitCode, attempt);

            
            var infoCommandResponse = new InfoCommandResponse(client.Output.ToString());
            return this.ServerMode  ? infoCommandResponse.ServerInformation : infoCommandResponse.LocalInformation;
        }