FixtureFor() public method

public FixtureFor ( string name ) : FixtureGraph
name string
return FixtureGraph
        public void SetUp()
        {
            library = new FixtureLibrary();
            FixtureGraph fixture1 = library.FixtureFor("Math");
            fixture1.AddStructure("Grammar1", new Sentence());
            fixture1.AddStructure("Grammar2", new Sentence());
            fixture1.AddStructure("Grammar3", new Sentence());

            FixtureGraph fixture2 = library.FixtureFor("Arithmetic");
            fixture2.AddStructure("Grammar4", new Sentence());
            fixture2.AddStructure("Grammar5", new Sentence());
        }
Esempio n. 2
0
        public UsageGraph(FixtureLibrary library, IUsageGraphListener listener)
        {
            _library = library;
            _listener = listener;

            _fixtures.OnMissing = name =>
            {
                var fixture = library.FixtureFor(name);
                return new FixtureUsage(fixture);
            };
        }
        public void create_an_embeddedSection_grammar_structure()
        {
            var library = new FixtureLibrary();
            FixtureGraph fixture = library.FixtureFor("Arithmetic");

            var grammar = new EmbeddedSectionGrammar<ArithmeticFixture>
            {
                Label = "The embedded section",
                Style = EmbedStyle.Inline
            }.LeafName("step name");
            var embeddedSection = grammar.ToStructure(library).ShouldBeOfType<EmbeddedSection>();

            embeddedSection.ShouldEqual(new EmbeddedSection(fixture, grammar.Label, grammar.LeafName()));
        }
        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"));
        }
Esempio n. 5
0
        void ITestVisitor.StartSection(Section section)
        {
            if (isLatched)
            {
                return;
            }
            string fixtureName = section.GetName();

            if (_library.HasFixture(fixtureName))
            {
                FixtureGraph fixture = _library.FixtureFor(fixtureName);
                _fixtureStack.Push(fixture);
                _stream.StartSection(section, fixture);
            }
            else
            {
                _stream.InvalidSection(section);
                _latchedSection = section;
            }
        }
Esempio n. 6
0
    static FixtureGraph()
    {
        _library = new Lazy<FixtureLibrary>(() => {
                var library = new FixtureLibrary();

                _current.Value._fixtureTypes.Each((key, type) => {
                    var fixtureStructure = library.FixtureFor(key);

                    try
                    {
                        var fixture = (IFixture)Activator.CreateInstance(type);
                        fixtureStructure.ReadFrom(fixture, library);
                    }
                    catch (Exception ex)
                    {
                        fixtureStructure.LogError(ex);
                    }

                });

                return library;
            });
    }
        public void SetUp()
        {
            library = new FixtureLibrary();
            library.FixtureFor("Math").Policies.IsPrivate = false;
            library.FixtureFor("Algebra").Policies.IsPrivate = false;
            library.FixtureFor("MathDetails").Policies.IsPrivate = true;
            library.FixtureFor("Calculus").Policies.IsPrivate = false;

            topFixture = library.BuildTopLevelGraph();

            mathSection = topFixture.GrammarFor("Math").ShouldBeOfType<EmbeddedSection>();
        }
        public void should_copy_the_style_from_the_grammar()
        {
            var library = new FixtureLibrary();
            FixtureGraph fixture = library.FixtureFor("Arithmetic");

            var grammar = new EmbeddedSectionGrammar<ArithmeticFixture>
            {
                Label = "The embedded section",
                Style = EmbedStyle.Inline
            }.LeafName("step name");
            var embeddedSection = grammar.ToStructure(library).ShouldBeOfType<EmbeddedSection>();

            embeddedSection.Style.ShouldEqual(EmbedStyle.Inline);
        }
        public void SetUp()
        {
            container = new Container();
            view = new StubExplorerView();
            shellConductor = MockRepository.GenerateMock<IScreenConductor>();

            explorer = new FixtureExplorer(view, container);

            library = new FixtureLibrary();
            FixtureGraph fixture1 = library.FixtureFor("Math");
            fixture1.AddStructure("Grammar1", new Sentence());
            fixture1.AddStructure("Grammar2", new Sentence());
            fixture1.AddStructure("Grammar3", new Sentence());

            FixtureGraph fixture2 = library.FixtureFor("Arithmetic");
            fixture2.AddStructure("Grammar4", new Sentence());
            fixture2.AddStructure("Grammar5", new Sentence());

            explorer.Handle(new BinaryRecycleFinished(library));
        }