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>(); }
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>(); }
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>(); }
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); }
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); }
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>(); }
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); }