コード例 #1
0
        public static void CreateEnvironment(IRunSettings runSettings, IMessageLogger messageLogger, out ILogger logger, out SettingsWrapper settings)
        {
            RunSettingsProvider settingsProvider;

            try
            {
                settingsProvider = runSettings.GetSettings(GoogleTestConstants.SettingsName) as RunSettingsProvider;
            }
            catch (Exception e)
            {
                settingsProvider = null;
                messageLogger.SendMessage(TestMessageLevel.Error, $"ERROR: Visual Studio test framework failed to provide settings; using default settings. Error message: {e.Message}");
            }

            RunSettingsContainer ourRunSettings = settingsProvider?.SettingsContainer ?? new RunSettingsContainer();

            foreach (RunSettings projectSettings in ourRunSettings.ProjectSettings)
            {
                projectSettings.GetUnsetValuesFrom(ourRunSettings.SolutionSettings);
            }

            var settingsWrapper = new SettingsWrapper(ourRunSettings);

            var loggerAdapter = new VsTestFrameworkLogger(messageLogger, () => settingsWrapper.DebugMode, () => settingsWrapper.TimestampOutput);
            var regexParser   = new RegexTraitParser(loggerAdapter);

            settingsWrapper.RegexTraitParser = regexParser;

            settings = settingsWrapper;
            logger   = loggerAdapter;
        }
コード例 #2
0
        public static void CreateEnvironment(IRunSettings runSettings, IMessageLogger messageLogger, out ILogger logger, out SettingsWrapper settings, string solutionDir = null)
        {
            if (string.IsNullOrWhiteSpace(solutionDir))
            {
                solutionDir = null;
            }

            var settingsProvider = SafeGetRunSettingsProvider(runSettings, messageLogger);

            var ourRunSettings = GetRunSettingsContainer(settingsProvider, messageLogger);

            foreach (RunSettings projectSettings in ourRunSettings.ProjectSettings)
            {
                projectSettings.GetUnsetValuesFrom(ourRunSettings.SolutionSettings);
            }

            var settingsWrapper = new SettingsWrapper(ourRunSettings, solutionDir);

            var loggerAdapter = new VsTestFrameworkLogger(messageLogger, () => settingsWrapper.DebugMode, () => settingsWrapper.TimestampOutput);
            var regexParser   = new RegexTraitParser(loggerAdapter);

            settingsWrapper.RegexTraitParser = regexParser;

            settings = settingsWrapper;
            logger   = loggerAdapter;
        }
コード例 #3
0
        public static void CreateEnvironment(IRunSettings runSettings, IMessageLogger messageLogger, out ILogger logger, out SettingsWrapper settings)
        {
            var settingsProvider = runSettings.GetSettings(GoogleTestConstants.SettingsName) as RunSettingsProvider;
            RunSettingsContainer ourRunSettings = settingsProvider != null ? settingsProvider.SettingsContainer : new RunSettingsContainer();
            var settingsWrapper = new SettingsWrapper(ourRunSettings);

            var loggerAdapter = new VsTestFrameworkLogger(messageLogger, () => settingsWrapper.DebugMode, () => settingsWrapper.TimestampOutput);
            var regexParser   = new RegexTraitParser(loggerAdapter);

            settingsWrapper.RegexTraitParser = regexParser;

            settings = settingsWrapper;
            logger   = loggerAdapter;
        }
コード例 #4
0
        public static void CreateEnvironment(IRunSettings runSettings, IMessageLogger messageLogger, out ILogger logger, out SettingsWrapper settings)
        {
            var settingsProvider = runSettings.GetSettings(GoogleTestConstants.SettingsName) as RunSettingsProvider;
            RunSettingsContainer ourRunSettings = settingsProvider != null ? settingsProvider.SettingsContainer : new RunSettingsContainer();

            foreach (RunSettings projectSettings in ourRunSettings.ProjectSettings)
            {
                projectSettings.GetUnsetValuesFrom(ourRunSettings.SolutionSettings);
            }

            var testSettings = runSettings.GetSettings(GoogleTestConstants.TestPropertySettingsName) as TestPropertySettingsProvider;

            var settingsWrapper = new SettingsWrapper(ourRunSettings, testSettings?.TestPropertySettings);

            var loggerAdapter = new VsTestFrameworkLogger(messageLogger, () => settingsWrapper.DebugMode, () => settingsWrapper.TimestampOutput);
            var regexParser   = new RegexTraitParser(loggerAdapter);

            settingsWrapper.RegexTraitParser = regexParser;

            settings = settingsWrapper;
            logger   = loggerAdapter;
        }
コード例 #5
0
 public Options(IXmlOptions xmlOptions, ILogger logger)
 {
     this.XmlOptions       = xmlOptions;
     this.TestEnvironment  = new TestEnvironment(this, logger);
     this.RegexTraitParser = new RegexTraitParser(TestEnvironment);
 }