public void SetUp()
        {
            var container = new Container();
            var registry = new FixtureRegistry();
            registry.AddFixture<FixtureWithHiddenGrammarsFixture>();
            registry.AddFixturesToContainer(container);
            var context = new TestContext(container);

            var observer = MockRepository.GenerateMock<IFixtureObserver>();
            var builder = new LibraryBuilder(observer, new CompositeFilter<Type>(), new ObjectConverter());

            builder.Build(context);

            library = builder.Library;
        }
Пример #2
0
        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());
            }
        }
Пример #3
0
        public void calls_listener_start_section()
        {
            var container = new Container();
            var registry = new FixtureRegistry();
            registry.AddFixture<MathFixture>();
            registry.AddFixturesToContainer(container);

            var context = new TestContext(container);
            var listener = MockRepository.GenerateMock<ITestObserver>();
            context.Listener = listener;

            listener.Expect(x => x.CanContinue(null)).Return(true).IgnoreArguments().Repeat.Any();

            var section = new Section("Math");
            context.CallOn<ITestVisitor>(x => x.StartSection(section));

            listener.AssertWasCalled(x => x.StartSection(section));
        }
        public void SetUp()
        {
            var builder = new LibraryBuilder(new NulloFixtureObserver(), new CompositeFilter<Type>(), new ObjectConverter());
            var registry = new FixtureRegistry();
            registry.AddFixturesFromAssemblyContaining<SetUserAction>();

            var container = new Container();
            registry.AddFixturesToContainer(container);
            var context = new TestContext(container);

            library = builder.Build(context);
        }
        public void SetUp()
        {
            container = new Container();
            var registry = new FixtureRegistry();
            registry.AddFixturesFromThisAssembly();
            registry.AddFixturesToContainer(container);

            observer = MockRepository.GenerateMock<IFixtureObserver>();
            var filter = new CompositeFilter<Type>();
            filter.Includes += t => t.Name.StartsWith("M");

            builder = new LibraryBuilder(observer, filter, new ObjectConverter());

            library = builder.Build(new TestContext(container));
        }
Пример #6
0
        private void fixturesShouldBe(params string[] names)
        {
            var container = new Container();
            var registry = new FixtureRegistry();
            registry.AddFixture<OhioFixture>();
            registry.AddFixture<WisconsinFixture>();
            registry.AddFixture<IllinoisFixture>();
            registry.AddFixture<NorthFixture>();
            registry.AddFixture<SouthFixture>();

            registry.AddFixturesToContainer(container);

            var builder = new LibraryBuilder(new NulloFixtureObserver(),
                                             project.CurrentFixtureFilter().CreateTypeFilter(), new ObjectConverter());
            var library = builder.Build(new TestContext(container));

            Array.Sort(names);

            library.ActiveFixtures.Select(x => x.Name).ShouldHaveTheSameElementsAs(names);
        }