public static FixtureLibrary BuildLibrary(SystemLifecycle lifeCycle, IFixtureObserver observer, IContainer container, CompositeFilter <Type> filter) { try { var builder = new LibraryBuilder(observer, filter); observer.RecordStatus("Starting to rebuild the fixture model"); var context = new TestContext(container); observer.RecordStatus("Setting up the system environment"); lifeCycle.StartApplication(); lifeCycle.SetupEnvironment(); observer.RecordStatus("Registering the system services"); lifeCycle.RegisterServices(context); builder.Finder = context.Finder; observer.RecordStatus("Starting to read fixtures"); return(builder.Build(context)); } finally { observer.RecordStatus("Finished rebuilding the fixture model"); } }
internal TestRun(TestExecutionRequest request, IFixtureContainerSource fetchContainer, ITestObserver listener, FixtureLibrary library, SystemLifecycle lifecycle) { _request = request; _fetchContainer = fetchContainer; _listener = listener; _library = library; _lifecycle = lifecycle; _result = new TestResult(); }
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()); } }
public TestRunner(SystemLifecycle lifecycle, FixtureLibrary library, IFixtureContainerSource source) { _lifecycle = lifecycle; _library = library; _source = source; }