public void ExecuteShouldNotThrowSettingsExceptionButLogOutput()
        {
            var activeRunSetting = RunSettingsManager.Instance.ActiveRunSettings;
            var runSettingsFile  = Path.Combine(Path.GetTempPath(), "ExecutorShouldShowRightErrorMessage.runsettings");

            try
            {
                if (File.Exists(runSettingsFile))
                {
                    File.Delete(runSettingsFile);
                }

                var fileContents = @"<RunSettings>
                                    <LoggerRunSettings>
                                        <Loggers>
                                            <Logger invalidName=""trx"" />
                                        </Loggers>
                                    </LoggerRunSettings>
                                </RunSettings>";

                File.WriteAllText(runSettingsFile, fileContents);

                var      testSourceDllPath = Path.GetTempFileName();
                string[] args       = { testSourceDllPath, "/settings:" + runSettingsFile };
                var      mockOutput = new MockOutput();

                var exitCode = new Executor(mockOutput, this.mockTestPlatformEventSource.Object).Execute(args);

                var result = mockOutput.Messages.Any(o => o.Level == OutputLevel.Error && o.Message.Contains("Invalid settings 'Logger'. Unexpected XmlAttribute: 'invalidName'."));
                Assert.IsTrue(result, "expecting error message : Invalid settings 'Logger'.Unexpected XmlAttribute: 'invalidName'.");
            }
            finally
            {
                File.Delete(runSettingsFile);
                RunSettingsManager.Instance.SetActiveRunSettings(activeRunSetting);
            }
        }
Exemple #2
0
 public void OutputMessages()
 {
     MockOutput     mock   = new MockOutput();
     OutputMessages output = new OutputMessages(CliOptions.WindowsStyle, mock);
 }
 public void TearDown()
 {
     _input  = null;
     _output = null;
 }
 public void SetUp()
 {
     _input  = new MockInput();
     _output = new MockOutput();
 }
 public void TearDown()
 {
     _menu       = null;
     _menuInput  = null;
     _menuOutput = null;
 }
 public void TearDown()
 {
     _fighter = null;
     _output  = null;
     _printer = null;
 }
Exemple #7
0
 public void TearDown()
 {
     _menuManager = null;
     _menuInput   = null;
     _menuOutput  = null;
 }