Example #1
0
 public static void AddFilter(this DefaultDescriptorBuilder target, IDescriptorFilter filter)
 {
     target.Filters.Add(filter);
 }
        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");
        }