예제 #1
0
        private MethodUnitTestCollection GetChangeforChangedFiles(List <TFSFileState> changedFiles, TfsVariable tfsVariables, Solution solution)
        {
            var depo = new MethodUnitTestCollection();

            if (!changedFiles.Any())
            {
                return(depo);
            }

            foreach (var itmChanged in changedFiles)
            {
                var webPath       = itmChanged.FilePath.Substring(1).Replace("/", "\\");
                var serverVersion = TFSHelper.DownloadFile(webPath);
                serverVersion = string.IsNullOrEmpty(serverVersion) ? serverVersion : serverVersion.Replace("\r\n", "\n");
                var      localVersionFullPath = Path.Combine(tfsVariables.BuildSourceDirectory, webPath);
                var      report = GetFileChanges(serverVersion, localVersionFullPath);
                Document doc    = null;
                foreach (var tmp in solution.Projects)
                {
                    doc = tmp.Documents.FirstOrDefault(x => x.FilePath == localVersionFullPath);
                    if (doc != null)
                    {
                        break;
                    }
                }
                if (doc == null)
                {
                    WriteDetail(string.Format("(Changed) No project document found for : {0}", localVersionFullPath));
                    return(null);
                }

                var tmpMethods = GetChangedPublicMethods(doc, report);
                if (tmpMethods != null)
                {
                    depo.Add(doc, tmpMethods);
                }
            }

            return(depo);
        }
예제 #2
0
        private MethodUnitTestCollection GetChangeforChangedAdded(List <TFSFileState> codesAdded, TfsVariable tfsVariables, Solution solution)
        {
            var depo = new MethodUnitTestCollection();

            if (!codesAdded.Any())
            {
                return(depo);
            }

            foreach (var itmChanged in codesAdded)
            {
                var      webPath = itmChanged.FilePath.Replace("/", "\\").TrimStart('\\');
                var      localVersionFullPath = Path.Combine(tfsVariables.BuildSourceDirectory, webPath);
                Document doc = null;
                foreach (var tmp in solution.Projects)
                {
                    doc = tmp.Documents.FirstOrDefault(x => x.FilePath == localVersionFullPath);
                    if (doc != null)
                    {
                        break;
                    }
                }
                if (doc == null)
                {
                    WriteDetail(string.Format("(Added) No project document found for : {0}", localVersionFullPath));
                    return(null);
                }

                var tmpMethods = GetAllPublicMethods(doc);
                if (tmpMethods != null)
                {
                    depo.Add(doc, tmpMethods);
                }
            }

            return(depo);
        }