示例#1
0
            public PostProcTestContext(TestContext testContext)
            {
                this.Config   = new AnalysisConfig();
                this.settings = TeamBuildSettings.CreateNonTeamBuildSettingsForTesting(testContext.DeploymentDirectory);

                this.logger        = new TestLogger();
                this.codeCoverage  = new MockCodeCoverageProcessor();
                this.scanner       = new MockSonarScanner();
                this.reportBuilder = new MockSummaryReportBuilder();

                this.codeCoverage.InitialiseValueToReturn = true;
                this.codeCoverage.ProcessValueToReturn    = true;
            }
            public PostProcTestContext(TestContext testContext)
            {
                Config   = new AnalysisConfig();
                settings = TeamBuildSettings.CreateNonTeamBuildSettingsForTesting(testContext.DeploymentDirectory);

                logger             = new TestLogger();
                codeCoverage       = new MockCodeCoverageProcessor();
                scanner            = new MockSonarScanner();
                reportBuilder      = new MockSummaryReportBuilder();
                TargetsUninstaller = new Mock <ITargetsUninstaller>();
                var callCount = 0;

                TargetsUninstaller
                .Setup(m => m.UninstallTargets(Logger))
                .Callback(() =>
                {
                    // Verify that the method was called maximum once
                    Assert.IsTrue(callCount == 0, "Method should be called exactly once");
                    callCount++;
                });

                codeCoverage.InitialiseValueToReturn = true;
                codeCoverage.ProcessValueToReturn    = true;
            }