Ejemplo n.º 1
0
        public void Parse_MostBasicConfiguration()
        {
            var result = DefaultFilter.ParseConfig(XElement.Parse(@"<root>
                <TraceOn class=""public"" method =""public"" />
            </root>").Descendants()).ToList();

            result.Count.Should().Be(1);
            result[0].Should().BeOfType <AssemblyLevelTraceOnDefinition>();
        }
Ejemplo n.º 2
0
        public void ParseConfig_WrongAttributeValue_Throws()
        {
            var input = new XElement("Tracer",
                                     new XElement("TraceOn", new XAttribute("class", "wrongvalue"), new XAttribute("method", "private"))
                                     );

            Action runParse = () => DefaultFilter.ParseConfig(input.Descendants());

            runParse.ShouldThrow <Exception>();
        }
Ejemplo n.º 3
0
        public void ParseConfig_MissingAttribute_Throws()
        {
            XElement input = new XElement("Tracer",
                                          new XElement("TraceOn", new XAttribute("method", "private"))
                                          );

            Action runParse = () => DefaultFilter.ParseConfig(input.Descendants());

            runParse.ShouldThrow <ApplicationException>();
        }
Ejemplo n.º 4
0
        public void ParseConfig_PrivateConfig_Parsed()
        {
            var input = new XElement("Tracer",
                                     new XElement("TraceOn", new XAttribute("class", "internal"), new XAttribute("method", "private"))
                                     );

            var parseResult = DefaultFilter.ParseConfig(input.Descendants()).ToList();

            parseResult.Count.Should().Be(1);
            parseResult[0].TargetClass.Should().Be(DefaultFilter.TraceTargetVisibility.InternalOrMoreVisible);
            parseResult[0].TargetMethod.Should().Be(DefaultFilter.TraceTargetVisibility.All);
        }
Ejemplo n.º 5
0
        public void ParseConfig_DefaultConfig_Parsed()
        {
            var input = new XElement("Tracer",
                                     new XElement("TraceOn", new XAttribute("class", "public"), new XAttribute("method", "public"))
                                     );

            var parseResult = DefaultFilter.ParseConfig(input.Descendants()).ToList();

            parseResult.Count.Should().Be(1);
            parseResult[0].Should().BeOfType <AssemblyLevelTraceOnDefinition>();
            ((AssemblyLevelTraceOnDefinition)parseResult[0]).TargetClass.Should().Be(TraceTargetVisibility.Public);
            ((AssemblyLevelTraceOnDefinition)parseResult[0]).TargetMethod.Should().Be(TraceTargetVisibility.Public);
        }
Ejemplo n.º 6
0
        public void Parse_MultiElement_Configuration()
        {
            var result = DefaultFilter.ParseConfig(XElement.Parse(@"<root>
                <TraceOn class=""public"" method =""public"" />
                <TraceOn namespace=""rootnamespace"" class=""public"" method =""public"" />
                <NoTrace namespace=""rootnamespace.other"" />
            </root>").Descendants()).ToList();

            result.Count.Should().Be(3);
            result[0].Should().BeOfType <AssemblyLevelTraceOnDefinition>();
            result[1].Should().BeOfType <AssemblyLevelTraceOnDefinition>();
            result[2].Should().BeOfType <AssemblyLevelNoTraceDefinition>();
        }
Ejemplo n.º 7
0
        public void ParseConfig_PrivateConfig_Parsed()
        {
            XElement input = new XElement("Tracer",
                                          new XElement("TraceOn", new XAttribute("class", "internal"), new XAttribute("method", "private"))
                                          );

            List <AssemblyLevelTraceDefinition> parseResult = DefaultFilter.ParseConfig(input.Descendants()).ToList();

            parseResult.Count.Should().Be(1);
            parseResult[0].Should().BeOfType <AssemblyLevelTraceOnDefinition>();
            ((AssemblyLevelTraceOnDefinition)parseResult[0]).TargetClass.Should().Be(TraceTargetVisibility.InternalOrMoreVisible);
            ((AssemblyLevelTraceOnDefinition)parseResult[0]).TargetMethod.Should().Be(TraceTargetVisibility.All);
        }