Example #1
0
        public FixtureLibrary StartSystem(FixtureAssembly fixtureAssembly, MarshalByRefObject remotePublisher)
        {
            _publisher = (IEventPublisher)remotePublisher;

            // TODO -- if fails, do a Thread.Sleep and try again
            _system = fixtureAssembly.FindSystem();
            ProjectFileSystem.RootFolder = fixtureAssembly.RootFolder;

            Project.Current = new Project
            {
                Profile = fixtureAssembly.Profile
            };

            try
            {
                var library = FixtureGraph.Library;
                _runner = new TestRunner(_system, library);
                if (_listener != null)
                {
                    _runner.Listener = _listener;
                }

                return library;
            }
            catch (TestEngineFailureException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new TestEngineFailureException(e.ToString());
            }
        }
 public void SetUp()
 {
     fa = new FixtureAssembly(new Project()
     {
         ProjectFolder = "root",
         SystemTypeName = typeof(GrammarSystem).AssemblyQualifiedName
     });
 }
        public void use_the_single_type_from_the_named_assembly()
        {
            var fa = new FixtureAssembly
            {
                AssemblyName = typeof (ExampleSystem).Assembly.GetName().Name
            };

            fa.DetermineSystemType().ShouldEqual(typeof (ExampleSystem));
            fa.FindSystem().ShouldBeOfType<ExampleSystem>();
        }
        public void can_serialize_the_fixture_assembly_class()
        {
            var fa = new FixtureAssembly(null, "StoryTeller.Testing");
            var stream = new MemoryStream();
            var formatter = new BinaryFormatter();
            formatter.Serialize(stream, fa);

            stream.Position = 0;

            var fa2 = (FixtureAssembly)formatter.Deserialize(stream);
        }
        public void copies_the_root_and_assembly_names()
        {
            var project = new Project
            {
                ProjectFolder = Path.Combine("src", "Foo"),
            };

            var assembly = new FixtureAssembly(project);
            assembly.RootFolder.ShouldEqual(project.GetTestFolder());
            assembly.AssemblyName.ShouldEqual("Foo");
        }
Example #6
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 registry = new FixtureRegistry();
                _system.RegisterFixtures(registry);

                var container = registry.BuildContainer();


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

                return(library);
            }
            catch (TestEngineFailureException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new TestEngineFailureException(e.ToString());
            }
        }
        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 void pulls_the_current_filter_from_the_project()
        {
            var project = new Project
            {
                FixtureAssembly = typeof (GrammarMarker).Assembly.GetName().Name
            };

            project.WorkspaceFor("1").AddFilter(new FixtureFilter()
            {
                Name = "North", Type = FilterType.Fixture
            });

            project.WorkspaceFor("2").AddFilter(new FixtureFilter()
            {
                Name = "South",
                Type = FilterType.Fixture
            });

            project.SelectWorkspaces(new string[]{"1", "2"});

            var fa = new FixtureAssembly(project);

            fa.Filter.Filters.ShouldHaveTheSameElementsAs(project.CurrentFixtureFilter().Filters);
        }
 public void SetUp()
 {
     fa = new FixtureAssembly();
 }
 public void can_find_candidate_types()
 {
     var types = new FixtureAssembly().FindSystemTypes();
     types.ShouldContain(typeof(FooSystem));
     types.ShouldContain(typeof(BarSystem));
 }
 public void SetUp()
 {
     fa = new FixtureAssembly();
     fa.FindSystemTypes().Count().ShouldBeGreaterThan(1);
 }
 public void SetUp()
 {
     fa = new FixtureAssembly(typeof (GrammarSystem).AssemblyQualifiedName, null);
 }
 public void SetUp()
 {
     fa = new FixtureAssembly(null, GetType().Assembly.GetName().Name);
 }