Ejemplo n.º 1
0
        public static CompiledFixture CreateCompiledFixture(CellHandling cellHandling, Type type)
        {
            try
            {
                var fixture = Activator.CreateInstance(type) as Fixture;
                FixtureCache[type] = fixture;
                return(new CompiledFixture
                {
                    Fixture = fixture,
                    Model = fixture.Compile(cellHandling)
                });
            }
            catch (Exception e)
            {
                var fixture = new InvalidFixture(type, e);
                var model   = fixture.Compile(cellHandling);
                model.implementation = type.FullName;

                return(new CompiledFixture
                {
                    Fixture = fixture,
                    Model = model
                });
            }
        }
Ejemplo n.º 2
0
        public static CompiledFixture CreateCompiledFixture(CellHandling cellHandling, Type type)
        {
            try
            {
                var fixture = Activator.CreateInstance(type) as Fixture;
                FixtureCache[type] = fixture;
                return new CompiledFixture
                {
                    Fixture = fixture,
                    Model = fixture.Compile(cellHandling)
                };
            }
            catch (Exception e)
            {
                var fixture = new InvalidFixture(type, e);
                var model = fixture.Compile(cellHandling);
                model.implementation = type.FullName;

                return new CompiledFixture
                {
                    Fixture = fixture,
                    Model = model
                };
            }
        }
        public void creates_the_grammar_error()
        {
            var ex = new DivideByZeroException("No!");
            var fixture = new InvalidFixture(typeof (FixtureThatBlowsUp), ex);

            var model = fixture.Compile(null);
            var error = model.errors.Single();

            error.error.ShouldBe(ex.ToString());
            error.message.ShouldBe("Fixture StoryTeller.Testing.FixtureThatBlowsUp could not be loaded");
        }