コード例 #1
0
        public virtual void setup()
        {
            controllerProxy = new Mock <IControllerProxy>();

            connection = new Mock <IDiscoveryConnection>();

            adapter = new Mock <IDiscoveryAdapter>();
            adapter.Setup(a => a.Connect()).Returns(connection.Object);

            runner = new DiscoveryRunner(testAssemblyPath, controllerProxy.Object, adapter.Object);
        }
コード例 #2
0
        public ITestRunner Create(LaunchOptions options)
        {
            string testAssemblyPath = options.DotNet.Project;

            if (testAssemblyPath == null)
            {
                throw new DotNetTestNSpecException("Command line arguments must include path of test project assembly");
            }

            var controllerProxy = proxyFactory.Create(testAssemblyPath);

            if (!options.DotNet.Port.HasValue)
            {
                return(new ConsoleRunner(testAssemblyPath, controllerProxy, options.NSpec));
            }

            ITestRunner runner;

            if (options.DotNet.List)
            {
                var adapter = new DiscoveryAdapter(channelFactory);

                runner = new DiscoveryRunner(testAssemblyPath, controllerProxy, adapter);
            }
            else if (options.DotNet.WaitCommand)
            {
                var adapter = new ExecutionAdapter(channelFactory);

                runner = new ExecutionRunner(testAssemblyPath, controllerProxy, adapter);
            }
            else
            {
                throw new DotNetTestNSpecException("Design-time command line argument must include either list or wait command options");
            }

            return(runner);
        }