public GrammarStructure ToStructure(FixtureLibrary library)
 {
     return new SetVerification(_labelName, _leafName, cells())
     {
         Ordered = Ordered
     };
 }
Пример #2
0
 public OutlineTreeBuilder(Test test, FixtureLibrary library, IOutlineConfigurer configurer)
 {
     var workspace = test.GetWorkspace();
     _library = library.Filter(workspace.CreateFixtureFilter().Matches);
     _test = test;
     _configurer = configurer;
 }
Пример #3
0
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library)
 {
     return new SilentAction("Grammar", _position, _action, step)
     {
         Subject = Key
     };
 }
 public void CreatePlan(FixtureLibrary library)
 {
     performAction(() =>
     {
         Plan = Specification.CreatePlan(library);
     });
 }
        public void copies_grammars()
        {
            const string fixtureKey = "a key";

            var lib = new FixtureLibrary();
            var original = new FixtureModel(fixtureKey);
            lib.Models[fixtureKey] = original;

            original.AddGrammar(new Sentence { key = "sentence", format = "a format"});

            var overrides = new FixtureLibrary();
            var overriden = new FixtureModel(fixtureKey);
            overrides.Models[fixtureKey] = overriden;

            var result = lib.ApplyOverrides(overrides);

            result.Models.Count.ShouldBe(1);

            var fixture = result.Models[fixtureKey];
            ReferenceEquals(fixture, overrides.Models[fixtureKey]).ShouldBeFalse();
            fixture.key.ShouldBe(fixtureKey);

            fixture.grammars.Length.ShouldBe(1);

            var sentence = fixture.grammars[0] as Sentence;
            sentence.key.ShouldBe("sentence");
            sentence.format.ShouldBe("a format");
        }
Пример #6
0
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library, bool inTable = false)
 {
     return new SilentAction("Grammar", Position, _action, step)
     {
         Subject = Key
     };
 }
Пример #7
0
        public TestEditorTag(FixtureLibrary library)
            : base("div")
        {
            AddClass("main");
            Add("h2").AddClass(HtmlClasses.TEST_NAME);
            Id("testEditor");

            AddClass(HtmlClasses.TEST_EDITOR);

            _container = Add("div").AddClasses("container", HtmlClasses.SECTION, "test-editor");

            FixtureGraph fixture = library.BuildTopLevelGraph();

            HtmlTag holder = new HolderTag(fixture).AddClass("top-level-holder");
            holder.Children.Last().Render(false);

            Container
                .MetaData(GrammarConstants.LEAF_NAME, GrammarConstants.TEST)
                .MetaData(GrammarConstants.FIXTURE, GrammarConstants.TEST)
                .MetaData(GrammarConstants.SELECTION_MODE, SelectionMode.OneOrMore.ToString())
                .Append(holder)
                .Append(new HtmlTag("hr"));

            Container.ActionLink(fixture.Policies.AddGrammarText, GrammarConstants.ADD_SECTION_ACTIVATOR);
            Container.Append(new GrammarSelector(fixture).Build());
        }
Пример #8
0
        public FixtureLibrary Build(ITestContext context)
        {
            _library = new FixtureLibrary();

            context.VisitFixtures(this);

            return _library;
        }
Пример #9
0
        public CompositeExecution CreatePlan(FixtureLibrary library)
        {
            var fixture = library.Fixtures[Key];

            if (id.IsEmpty()) id = Guid.NewGuid().ToString();

            return CreatePlan(library, fixture);
        }
Пример #10
0
        public GrammarStructure ToStructure(FixtureLibrary library)
        {
            if (library == null) throw new ArgumentNullException("library");

            Cell[] cells = GetCells().Select(x => x.ToInputCell()).ToArray();

            return new Sentence(Template, cells);
        }
        public void SetUp()
        {
            Bootstrapper.ForceRestart();

            library = DataMother.MathProject().LocalRunner().Library;
            ObjectFactory.Inject(library);
            source = ObjectFactory.With(library).GetInstance<ExampleSource>();
        }
 public static void PostProcessAll(IEnumerable<Specification> specs, FixtureLibrary library)
 {
     foreach (var spec in specs)
     {
         spec.ClearErrors();
         var processor = new SpecificationPostProcessor(library, spec);
         processor.Validate();
     }
 }
        public void can_create_screen_for_fixturelibrary()
        {
            var library = new FixtureLibrary();
            var subject = _objectLocator.BuildSubject(library).ShouldBeOfType<FixtureNodeSubject>();

            subject.Subject.ShouldBeTheSameAs(library);
            var presenter = subject.CreateScreen(factory).ShouldBeOfType<FixtureNodePresenter>();
            presenter.Subject.ShouldBeTheSameAs(library);
        }
Пример #14
0
 public void should_have_a_label()
 {
     var fixture = new FactFixture();
     var grammar = fixture["True"];
     var fixtureLibrary = new FixtureLibrary();
     var sentence = grammar.ToStructure(fixtureLibrary) as Sentence;
     sentence.PartCount.ShouldEqual(1);
     sentence.Parts[0].ShouldBeOfType<Label>().Text.ShouldEqual("This is true");
 }
Пример #15
0
        public override void ResolveDependencies(FixtureLibrary library)
        {
            var embeddedKey = fixture.key;
            if (library.Models.Has(embeddedKey))
            {
                fixture = library.Models[embeddedKey];
            }

            
        }
 public void SetUp()
 {
     var runner = TestRunnerBuilder.For(x =>
     {
         x.AddFixture<MathFixture>();
         x.AddFixture<AnotherFixture>();
         x.AddFixture<DoSomeMathFixture>();
     });
     library = runner.Library;
 }
Пример #17
0
        public JavaScriptTestFile Fixtures(FixtureLibrary fixtureLibrary)
        {
            _library = fixtureLibrary;

            var writer = new GrammarWriter(_library);
            HtmlTag templates = writer.Build();
            Add(templates);

            return this;
        }
Пример #18
0
        // TODO -- if an error bubbles up, the SpecificationEngine should mark its runner
        //         as Invalid
        public static StepthroughExecutor Start(ISystem system, Specification specification, IResultObserver observer, IUserInterfaceObserver uiObserver, FixtureLibrary library)
        {
            var request = new SpecExecutionRequest(specification, observer);
            request.CreatePlan(library);

            // Got to watch because this can error out
            var execution = system.CreateContext();

            return new StepthroughExecutor(execution, request, uiObserver);
        }
Пример #19
0
        public void SetUp()
        {
            var context = new TestContext(x => { x.AddFixture<FixtureWithHiddenGrammarsFixture>(); });

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

            library = builder.Library;
        }
        private void buildFixtureSelectors(FixtureLibrary library, Cache<string, NamespaceSelector> namespaces, Cache<string, FixtureSelector> fixtures)
        {
            library.AllFixtures.Each(x =>
            {
                var item = new FixtureSelector(x);
                fixtures[x.Name] = item;

                namespaces[x.Namespace].Add(item);
            });
        }
Пример #21
0
        public JavaScriptTestFile Fixtures(Action<FixtureRegistry> configure)
        {
            _library = FixtureLibrary.For(configure);

            var writer = new GrammarWriter(_library);
            HtmlTag templates = writer.Build();
            Add(templates);

            return this;
        }
        public void PossibleFixtures_uses_the_constraint_model_of_each_fixture_graph()
        {
            var library = new FixtureLibrary();
            library.FixtureFor("fixture1").Policies.IsPrivate = true;
            library.FixtureFor("fixture2").Policies.IsPrivate = false;
            library.FixtureFor("fixture3").Policies.IsPrivate = true;
            library.FixtureFor("fixture4").Policies.IsPrivate = false;

            library.PossibleFixturesFor(new Test("something")).ShouldHaveTheSameElementsAs(
                library.FixtureFor("fixture2"), library.FixtureFor("fixture4"));
        }
Пример #23
0
        public UsageGraph(FixtureLibrary library, IUsageGraphListener listener)
        {
            _library = library;
            _listener = listener;

            _fixtures.OnMissing = name =>
            {
                var fixture = library.FixtureFor(name);
                return new FixtureUsage(fixture);
            };
        }
Пример #24
0
        public void SetUp()
        {
            theTest = new Test("something");
            theLibrary = new FixtureLibrary();

            nodeBuilder = MockRepository.GenerateMock<IOutlineConfigurer>();

            treeBuilder = new OutlineTreeBuilder(theTest, theLibrary, nodeBuilder);

            theContextIs();
        }
Пример #25
0
        public GrammarStructure ToStructure(FixtureLibrary library)
        {
            if (library == null) throw new ArgumentNullException("library");

            Cell[] cells = GetCells()
                .Where(x => x.IsTestVariable(library.Finder))
                .Select(x => x.ToExample())
                .ToArray();

            return new Sentence(Template, cells);
        }
Пример #26
0
        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 void Setup()
        {
            runner = StoryTeller.Testing.DataMother.GrammarsProjectRunner();
            theLibrary = runner.GetLibary();

            controller = MockRepository.GenerateMock<IOutlineController>();

            service = new OutlineTreeService(new ProjectContext()
            {
                Library = theLibrary
            });
        }
        private string[] getAllNamespaces(FixtureLibrary library, Cache<string, NamespaceSelector> namespaces)
        {
            library.AllFixtures.Each(x =>
            {
                var o = namespaces[x.Namespace];
            });

            var names = namespaces.GetAllKeys();
            Array.Sort(names);

            return names;
        }
Пример #29
0
        private static void writeInitialData(HtmlDocument document, Suite top, FixtureLibrary fixtures, string title)
        {
            ClientMessage[] initial = new ClientMessage[]
            {
                new FixturesReloaded {fixtures = fixtures.Models.ToArray()},
                new HierarchyLoaded(top, new ResultsCache()),
                new ProjectTitle(title),
            };

            var cleanJson = JsonSerialization.ToCleanJson(initial);
            document.Body.Add("div").Hide().Id("spec-data").Text(cleanJson);
        }
Пример #30
0
        // TODO -- needs to change to IContainer child container
        public FixtureLibrary Build(TestContext context)
        {
            _library = new FixtureLibrary()
            {
                Finder = _finder
            };

            readFixtures(context);
            readActions(context.Container);

            return _library;
        }
Пример #31
0
        public FixtureLibrary ApplyOverrides(FixtureLibrary overrides)
        {
            var newLibrary = new FixtureLibrary();

            Models.Each(model =>
            {
                FixtureModel over;
                overrides.Models.TryRetrieve(model.key, out over);
                newLibrary.Models[model.key] = (FixtureModel)model.ApplyOverrides(over);
            });

            var keys    = newLibrary.Models.Select(x => x.key).ToList();
            var missing = overrides.Models.Where(x => !keys.Contains(x.key));

            missing.Each(model =>
            {
                newLibrary.Models[model.key] = (FixtureModel)model.ApplyOverrides(null);
            });

            return(newLibrary);
        }
Пример #32
0
        private IEnumerable<IExecutionStep> toExecutionSteps(FixtureLibrary library, Fixture fixture)
        {
            var setup = SilentAction.AsCritical("Fixture", Stage.setup, x =>
            {
                fixture.Context = x;
                fixture.SetUp();
            }, this);
            setup.Subject = Key + ":SetUp";

            yield return setup;

            // Ignore comments!
            foreach (var step in Children.OfType<Step>())
            {
                var grammar = fixture.GrammarFor(step.Key);
                yield return grammar.CreatePlan(step, library);
            }

            var teardown = SilentAction.AsCritical("Fixture", Stage.teardown, x => fixture.TearDown(), this);
            teardown.Subject = Key + ":TearDown";
            yield return teardown;
        }
Пример #33
0
        public void ApplyFixtureOverrides(FixtureLibrary systemLibrary, FixtureLibrary overrides)
        {
            var embeddedKey = fixture.key;

            if (systemLibrary.Models.Has(embeddedKey))
            {
                var systemFixture = systemLibrary.Models[embeddedKey];

                fixture = overrides.Models.Has(embeddedKey)
                    ? systemFixture.ApplyOverrides(overrides.Models[embeddedKey]).As <FixtureModel>()
                    : systemFixture;
            }
            else
            {
                fixture = overrides.Models[embeddedKey];
            }

            if (collection.IsEmpty())
            {
                collection = fixture.key;
            }
        }
Пример #34
0
 public TestParser(Test test, ITestStream stream, FixtureLibrary library)
 {
     _test    = test;
     _stream  = stream;
     _library = library;
 }
 IExecutionStep IGrammar.CreatePlan(Step step, FixtureLibrary library, bool inTable = false)
 {
     return(new InvalidGrammarStep(new StepValues(step.id), _message));
 }
Пример #36
0
 public CompositeExecution CreatePlan(FixtureLibrary library, Fixture fixture)
 {
     return new CompositeExecution(toExecutionSteps(library, fixture).ToArray());
 }
Пример #37
0
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library)
 {
     return(new InvalidGrammarStep(new StepValues(step.id), _message));
 }
 public virtual void ResolveDependencies(FixtureLibrary library)
 {
     // Most won't care
 }
 public SpecificationPostProcessor(FixtureLibrary library, Specification spec)
 {
     _library = library;
     _spec    = spec;
 }