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"); } }
private void readFixtures(TestContext context) { _observer.RecordStatus("Discovering and filtering fixtures"); var fixtureConfiguration = context.Container.Model.For <IFixture>(); var instanceRefs = fixtureConfiguration.Instances.Where(i => _filter.Matches(i.ConcreteType)); FixtureCount = instanceRefs.Count(); instanceRefs.Each(readInstance); _library.AllFixtures = fixtureConfiguration.Instances.Select(x => new FixtureDto { Fullname = x.ConcreteType.FullName, Name = x.ConcreteType.GetFixtureAlias(), Namespace = x.ConcreteType.Namespace }).ToArray(); }