Exemplo n.º 1
0
        private void Init(Build buildDetail, string flavour, string platform, IEnumerable <ITestRun> testRuns, ICoverageAnalysisManager coverageAnalysisManager)
        {
            var testRunList = testRuns as IList <ITestRun> ?? testRuns.ToList();

            this.TestsFailed = testRunList.Select(run => run.Statistics.FailedTests).Sum();
            this.TestsPassed = testRunList.Select(run => run.Statistics.PassedTests).Sum();
            this.TestsTotal  = testRunList.Select(run => run.Statistics.TotalTests).Sum();

            this.FailedTests = new List <string>();
            foreach (ITestCaseResult testCaseResult in testRunList.SelectMany(testRun => testRun.QueryResultsByOutcome(TestOutcome.Failed)))
            {
                this.FailedTests.Add(testCaseResult.TestCaseTitle);
            }

            //var configurationSummary = InformationNodeConverters.GetConfigurationSummary(buildDetail, flavour, platform);

            //if (configurationSummary != null)
            //{
            //	this.HasWarnings = configurationSummary.TotalCompilationWarnings > 0;
            //}

            this.BuildFinished = buildDetail.FinishTime != null;
            this.FinishTime    = (buildDetail.FinishTime.HasValue ? buildDetail.FinishTime.Value.ToLocalTime() : (System.DateTime?)null);
            this.Status        = BuildStatusConverter.Convert(buildDetail.Status, buildDetail.Result);
            //this.CompilationStatus = BuildPhaseStatusConverter.Convert(buildDetail.CompilationStatus);
            //this.TestStatus = BuildPhaseStatusConverter.Convert(buildDetail.TestStatus);
            this.RequestedFor = buildDetail.RequestedFor.DisplayName;
            this.StartTime    = (buildDetail.StartTime.HasValue ? buildDetail.StartTime.Value.ToLocalTime() : (System.DateTime?)null);
            this.CodeCoverage = GetCodeCoverage(buildDetail, coverageAnalysisManager);
        }
        private static Build GetBuild(IBuildQueryResult result)
        {
            var buildDetail = result.Builds[0];

            Build webApiBuild = new Build
            {
                BuildNumber  = buildDetail.BuildNumber,
                Uri          = buildDetail.Uri,
                FinishTime   = buildDetail.FinishTime,
                StartTime    = buildDetail.StartTime,
                RequestedFor = new Microsoft.VisualStudio.Services.WebApi.IdentityRef(),
                Status       = BuildStatusConverter.Convert(buildDetail.Status),
                Result       = BuildStatusConverter.ConvertToBuildResult(buildDetail.Status)
            };

            webApiBuild.RequestedFor.DisplayName = buildDetail.RequestedFor;
            return(webApiBuild);
        }