Esempio n. 1
0
        public void EnvironmentVariable()
        {
            OpenSolution(CppConsoleApplication);
            using (var debugSettings = SolutionConfigurationHelpers.GetCurrentDebugSettings(CppConsoleApplication))
            {
                const string exitCode      = "EXIT_CODE";
                const string exitCodeValue = "42";
                const string testEnv       = "PATH";
                const string testEnvValue  = "1";

                var env = string.Format("{0}={1}\n{2}={3}\nIgnoredValue=",
                                        exitCode, exitCodeValue, testEnv, testEnvValue);;
                debugSettings.Value.Environment = env;
                var controller = ExecuteOpenCppCoverageCommand();
                RunInUIhread(() =>
                {
                    controller.BasicSettingController.Arguments = "TestEnvVariable";
                    CollectionAssert.AreEquivalent(
                        new List <KeyValuePair <string, string> > {
                        new KeyValuePair <string, string>(exitCode, exitCodeValue),
                        new KeyValuePair <string, string>(testEnv, testEnvValue)
                    },
                        controller.BasicSettingController.EnvironmentVariables.ToList());
                });
                var coverageTreeController = RunCoverageCommandAndWait(controller);

                Assert.AreEqual(
                    coverageTreeController.Warning,
                    CoverageTreeController.WarningMessage + exitCodeValue);
            }
        }
Esempio n. 2
0
        public void StartUpProjectSettings()
        {
            OpenSolution(CppConsoleApplication2);
            using (var debugSettings = SolutionConfigurationHelpers.GetCurrentDebugSettings(CppConsoleApplication2))
            {
                var settings = debugSettings.Value;
                settings.Command          = "Command";
                settings.CommandArguments = "Arguments";
                settings.WorkingDirectory = ".";

                var controller = ExecuteOpenCppCoverageCommand();
                var basicSettingsController = controller.BasicSettingController;
                Assert.AreEqual(settings.Command, basicSettingsController.BasicSettings.ProgramToRun);
                Assert.AreEqual(settings.CommandArguments, basicSettingsController.BasicSettings.Arguments);
                Assert.AreEqual(settings.WorkingDirectory, basicSettingsController.BasicSettings.OptionalWorkingDirectory);

                var expectedProjects = new List <string> {
                    CppConsoleApplication,
                    CppConsoleApplication2,
                    CppConsoleApplicationDll,
                    ConsoleApplicationInFolder,
                    ZeroCheck
                };
                CollectionAssert.AreEquivalent(
                    expectedProjects,
                    basicSettingsController.SelectableProjects.Select(p => p.FullName).ToList());
            }
        }
Esempio n. 3
0
        //---------------------------------------------------------------------
        EnvDTE80.SolutionConfiguration2 OpenSolution(
            string[] startupProjects,
            ConfigurationName configurationName,
            PlatFormName platformName)
        {
            OpenDefaultSolution();
            var startupProjectObjects = new object[startupProjects.Length];

            Array.Copy(startupProjects, startupProjectObjects, startupProjectObjects.Length);
            VsIdeTestHostContext.Dte.Solution.SolutionBuild.StartupProjects = startupProjectObjects;
            return(SolutionConfigurationHelpers.SetActiveSolutionConfiguration(configurationName, platformName));
        }
Esempio n. 4
0
        public void DisableCompileBeforeRunning()
        {
            OpenSolution(CppConsoleApplication);
            SolutionConfigurationHelpers.CleanSolution();
            var controller = ExecuteOpenCppCoverageCommand();

            controller.BasicSettingController.CompileBeforeRunning = false;

            RunInUIhread(() =>
            {
                var outputMessage = GetOpenCppCoverageMessage(() => RunCoverageCommand(controller));

                Assert.IsTrue(outputMessage.EndsWith(CoverageRunner.InvalidValueForProgramToRun));
            });
        }
Esempio n. 5
0
        public void InvalidProgramToRun()
        {
            OpenSolution(CppConsoleApplication);
            using (var debugSettings =
                       SolutionConfigurationHelpers.GetCurrentDebugSettings(
                           CppConsoleApplication))
            {
                var settings = debugSettings.Value;
                settings.Command = "Invalid";
                var outputMessage = GetOpenCppCoverageMessage(RunCoverage);

                CheckMessage(
                    string.Format(CoverageRunner.InvalidProgramToRunMsg, settings.Command),
                    outputMessage);
            }
        }