ApplyOverrides() public method

public ApplyOverrides ( GrammarModel grammar ) : GrammarModel
grammar GrammarModel
return GrammarModel
コード例 #1
0
        public override GrammarModel ApplyOverrides(GrammarModel grammar)
        {
            var @override = grammar as EmbeddedSection;

            if (@override == null)
            {
                return(this);
            }

            var section = new EmbeddedSection
            {
                key           = key,
                title         = title,
                collection    = collection,
                fixture       = (FixtureModel)fixture.ApplyOverrides(@override.fixture),
                hasBeforeStep = hasBeforeStep,
                hasAfterStep  = hasAfterStep
            };

            if (@override.title.IsNotEmpty())
            {
                section.title = @override.title;
            }

            return(section);
        }
コード例 #2
0
        public void can_mark_the_missing_grammars()
        {
            var system = new FixtureModel("something");
            system.AddGrammar(new Sentence {key = "Go1", format = "Go One"});

            var overrides = new FixtureModel("something");
            overrides.AddGrammar(new Sentence { key = "Go2", format = "Go Two" });

            var combined = system.ApplyOverrides(overrides).As<FixtureModel>();

            combined.FindGrammar("Go1").IsMissing.ShouldBeFalse();
            combined.FindGrammar("Go2").IsMissing.ShouldBeTrue();
        }