コード例 #1
0
        public void TestXmlFileNameGenerationNewOutputXmlFileForEachRun()
        {
            var logger   = Substitute.For <ITestLogger>();
            var settings = new AdapterSettings(logger);

            settings.Load("<RunSettings><NUnit><TestOutputXml>/my/work/dir</TestOutputXml><NewOutputXmlFileForEachRun>true</NewOutputXmlFileForEachRun></NUnit></RunSettings>");
            var sut = new NUnitEngineAdapter();

            sut.InitializeSettingsAndLogging(settings, logger);
            string path = sut.GetXmlFilePath("c:/", "assembly", "xml");

            Assert.That(path, Is.EqualTo("c:/assembly.1.xml"));
        }
コード例 #2
0
 // The Adapter is constructed using the default constructor.
 // We don't have any info to initialize it until one of the
 // ITestDiscovery or ITestExecutor methods is called. Each
 // Discover or Execute method must call this method.
 protected void Initialize(IDiscoveryContext context, IMessageLogger messageLogger)
 {
     NUnitEngineAdapter.Initialize();
     TestLog  = new TestLogger(messageLogger);
     Settings = new AdapterSettings(TestLog);
     NUnitEngineAdapter.InitializeSettingsAndLogging(Settings, TestLog);
     TestLog.InitSettings(Settings);
     try
     {
         Settings.Load(context);
         TestLog.Verbosity = Settings.Verbosity;
         InitializeForbiddenFolders();
         SetCurrentWorkingDirectory();
     }
     catch (Exception e)
     {
         TestLog.Warning("Error initializing RunSettings. Default settings will be used");
         TestLog.Warning(e.ToString());
     }
 }