public void Setup()
        {
            ctx = Substitute.For <IExecutionContext>();
            var settings = Substitute.For <IAdapterSettings>();

            settings.AssemblySelectLimit.Returns(10);
            ctx.Settings.Returns(settings);
            var engineAdapter = new NUnitEngineAdapter();

            engineAdapter.Initialize();
            ctx.EngineAdapter.Returns(engineAdapter);
            settings.DiscoveryMethod.Returns(DiscoveryMethod.Current);
            discovery = Substitute.For <IDiscoveryConverter>();
            discovery.NoOfLoadedTestCases.Returns(1);
            discovery.IsDiscoveryMethodCurrent.Returns(true);

            discovery.LoadedTestCases.Returns(new List <TestCase>
            {
                new ("A", new Uri(NUnitTestAdapter.ExecutorUri), "line 23")
            });
Exemplo n.º 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());
     }
 }