Example #1
0
        public ITestRunner Build()
        {
            var registry = new FixtureRegistry();

            _system.RegisterFixtures(registry);
            var        containerSource = new FixtureContainerSource(registry.BuildContainer());
            IContainer container       = containerSource.Build();
            var        observer        = _observer;

            var library = BuildLibrary(new SystemLifecycle(_system), observer, container, new CompositeFilter <Type>());

            return(new TestRunner(_system, library, containerSource));
        }
        public FixtureLibrary StartSystem(FixtureAssembly fixtureAssembly, MarshalByRefObject remotePublisher)
        {
            _publisher = (IEventPublisher)remotePublisher;
            var observer = new FixtureObserver(_publisher);

            // TODO -- if fails, do a Thread.Sleep and try again
            _system = fixtureAssembly.System;

            _lifecycle = new SystemLifecycle(_system);

            // TODO -- make this be async
            observer.RecordStatus("Setting up the environment");
            _lifecycle.StartApplication();

            try
            {
                var container = TestRunnerBuilder.BuildFixtureContainer(_system);
                var registry = new FixtureRegistry();
                _system.RegisterFixtures(registry);
                registry.AddFixturesToContainer(container);

                var library = TestRunnerBuilder.BuildLibrary(_lifecycle, observer, container, fixtureAssembly.Filter.CreateTypeFilter(), _system.BuildConverter());
                var source = new FixtureContainerSource(container);
                _runner = new TestRunner(_lifecycle, library, source);
                if (_listener != null)
                {
                    _runner.Listener = _listener;
                }

                return library;
            }
            catch (TestEngineFailureException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new TestEngineFailureException(e.ToString());
            }
        }