Example #1
0
        public void Use_Default_Report_File_Name_If_None_Is_Provided()
        {
            var coverageRunner = new CoverageRunner(_instrumentatorMock, _testRunnerMock, _coverageReportMock);

            coverageRunner.Run("testProjectOutputPath", string.Empty);

            _coverageReportMock.Received(1).Export(Arg.Any <CoverageContext>(),
                                                   Arg.Is <string>(s => s.EndsWith("coverage.xml"))
                                                   );
        }
Example #2
0
        public void Generate_Report_Once_Tests_Were_Executed()
        {
            var coverageRunner = new CoverageRunner(_instrumentatorMock, _testRunnerMock, _coverageReportMock);

            coverageRunner.Run("testProjectOutputPath", "report.xml");

            Received.InOrder(() =>
            {
                _testRunnerMock.Run(Arg.Any <CoverageContext>(), Arg.Any <string>());
                _coverageReportMock.Export(Arg.Any <CoverageContext>(), Arg.Any <string>());
            });
        }
Example #3
0
        public void Transform_Assembly_Before_Executing_Tests()
        {
            var coverageRunner = new CoverageRunner(_instrumentatorMock, _testRunnerMock, _coverageReportMock);

            coverageRunner.Run("testProjectOutputPath", "report.xml");

            Received.InOrder(() =>
            {
                _instrumentatorMock.ProcessAssembliesInFolder(Arg.Any <CoverageContext>(), Arg.Any <string>());
                _testRunnerMock.Run(Arg.Any <CoverageContext>(), Arg.Any <string>());
            });
        }
        //---------------------------------------------------------------------
        public void ShowSettingsWindows(
            CoverageRunner coverageRunner,
            ProjectSelectionKind kind)
        {
            var configurationManager = new ConfigurationManager();
            var settingsBuilder      = new StartUpProjectSettingsBuilder(this.dte, configurationManager);

            var window = this.package.FindToolWindow(
                typeof(SettingToolWindow), 0, true) as SettingToolWindow;

            if (window == null || window.Frame == null)
            {
                throw new NotSupportedException("Cannot create tool window");
            }

            window.Controller.StartUpProjectSettingsBuilder = settingsBuilder;
            window.Controller.CoverageRunner = coverageRunner;
            window.Controller.UpdateStartUpProject(kind);
            var frame = (IVsWindowFrame)window.Frame;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(frame.Show());
        }
Example #5
0
        //---------------------------------------------------------------------
        public MainSettingController(
            ISettingsStorage settingsStorage,
            IOpenCppCoverageCmdLine openCppCoverageCmdLine,
            IStartUpProjectSettingsBuilder startUpProjectSettingsBuilder,
            CoverageRunner coverageRunner)
        {
            this.settingsStorage        = settingsStorage;
            this.openCppCoverageCmdLine = openCppCoverageCmdLine;
            this.RunCoverageCommand     = new RelayCommand(() => OnRunCoverageCommand());
            this.CloseCommand           = new RelayCommand(() =>
            {
                this.CloseWindowEvent?.Invoke(this, EventArgs.Empty);
            });
            this.ResetToDefaultCommand = new RelayCommand(
                () => UpdateStartUpProject(ComputeStartUpProjectSettings(kind)));
            this.BasicSettingController         = new BasicSettingController();
            this.FilterSettingController        = new FilterSettingController();
            this.ImportExportSettingController  = new ImportExportSettingController();
            this.MiscellaneousSettingController = new MiscellaneousSettingController();

            this.coverageRunner = coverageRunner;
            this.startUpProjectSettingsBuilder = startUpProjectSettingsBuilder;
        }