public void SimplifiedUseMasterGrammarWithPrefixDetectsElementCorrectly() { var builder = new DefaultDescriptorBuilder("s"); var a = builder.ParseUseMaster(new Position(new SourceContext("<s:use master='a'/>"))); var b = builder.ParseUseMaster(new Position(new SourceContext("<s:use\r\nmaster \r\n =\r\n'b' />"))); var c = builder.ParseUseMaster(new Position(new SourceContext("<s:use master=\"c\"/>"))); var def = builder.ParseUseMaster(new Position(new SourceContext(" x <s:use etc=''/> <s:use master=\"def\"/> y "))); var none = builder.ParseUseMaster(new Position(new SourceContext(" x <s:use etc=''/> <using master=\"def\"/> y "))); var g = builder.ParseUseMaster(new Position(new SourceContext("-<s:use master=\"g\"/>-<s:use master=\"h\"/>-"))); Assert.That(a.Value, Is.EqualTo("a")); Assert.That(b.Value, Is.EqualTo("b")); Assert.That(c.Value, Is.EqualTo("c")); Assert.That(def.Value, Is.EqualTo("def")); Assert.That(none, Is.Null); Assert.That(g.Value, Is.EqualTo("g")); }
public void Descriptors_with_simplified_use_master_grammar_should_detect_element_correctly() { //Given var builder = new DefaultDescriptorBuilder(); //When var a = builder.ParseUseMaster(new Position(new SourceContext("<use master='a'/>"))); var b = builder.ParseUseMaster(new Position(new SourceContext("<use\r\nmaster \r\n =\r\n'b' />"))); var c = builder.ParseUseMaster(new Position(new SourceContext("<use master=\"c\"/>"))); var def = builder.ParseUseMaster(new Position(new SourceContext(" x <use etc=''/> <use master=\"def\"/> y "))); var none = builder.ParseUseMaster(new Position(new SourceContext(" x <use etc=''/> <using master=\"def\"/> y "))); var g = builder.ParseUseMaster(new Position(new SourceContext("-<use master=\"g\"/>-<use master=\"h\"/>-"))); //Then a.Value.ShouldEqual("a"); b.Value.ShouldEqual("b"); c.Value.ShouldEqual("c"); def.Value.ShouldEqual("def"); none.ShouldBeNull(); g.Value.ShouldEqual("g"); }
public void SimplifiedUseMasterGrammarWithPrefixDetectsElementCorrectly() { var builder = new DefaultDescriptorBuilder("s"); var a = builder.ParseUseMaster(new Position(new SourceContext("<s:use master='a'/>"))); var b = builder.ParseUseMaster(new Position(new SourceContext("<s:use\r\nmaster \r\n =\r\n'b' />"))); var c = builder.ParseUseMaster(new Position(new SourceContext("<s:use master=\"c\"/>"))); var def = builder.ParseUseMaster(new Position(new SourceContext(" x <s:use etc=''/> <s:use master=\"def\"/> y "))); var none = builder.ParseUseMaster(new Position(new SourceContext(" x <s:use etc=''/> <using master=\"def\"/> y "))); var g = builder.ParseUseMaster(new Position(new SourceContext("-<s:use master=\"g\"/>-<s:use master=\"h\"/>-"))); Assert.That(a.Value, Is.EqualTo("a")); Assert.That(b.Value, Is.EqualTo("b")); Assert.That(c.Value, Is.EqualTo("c")); Assert.That(def.Value, Is.EqualTo("def")); Assert.That(none, Is.Null); Assert.That(g.Value, Is.EqualTo("g")); }
public void EmptyPrefixIsConsideredNoPrefixAtAll() { var builder = new DefaultDescriptorBuilder(string.Empty); var a = builder.ParseUseMaster(new Position(new SourceContext("<use master='a'/>"))); Assert.That(a, Is.Not.Null); Assert.That(a.Value, Is.EqualTo("a")); }