public void Setup()
 {
     matchingRuleData =
         new CustomAttributeMatchingRuleData(
             "custom attribute",
             typeof(CLSCompliantAttribute).AssemblyQualifiedName,
             true);
 }
 public void Setup()
 {
     matchingRuleData =
         new CustomAttributeMatchingRuleData(
             "custom attribute",
             typeof(InjectionMethodAttribute).AssemblyQualifiedName,
             true);
 }
        protected static MatchingRuleData SerializeAndDeserializeMatchingRule(MatchingRuleData typeMatchingRule)
        {
            PolicyData policy = new PolicyData("policy");
            policy.MatchingRules.Add(typeMatchingRule);

            PolicyInjectionSettings settings = new PolicyInjectionSettings();
            settings.Policies.Add(policy);

            Dictionary<string, ConfigurationSection> sections = new Dictionary<string, ConfigurationSection>();
            sections.Add(PolicyInjectionSettings.SectionName, settings);

            IConfigurationSource configurationSource = ConfigurationTestHelper.SaveSectionsInFileAndReturnConfigurationSource(sections);

            PolicyInjectionSettings deserializedSection = configurationSource.GetSection(PolicyInjectionSettings.SectionName) as PolicyInjectionSettings;
            Assert.IsNotNull(deserializedSection);

            PolicyData deserializedPolicy = deserializedSection.Policies.Get(0);
            Assert.IsNotNull(deserializedPolicy);

            return deserializedPolicy.MatchingRules.Get(0);
        }
 public void Setup()
 {
     matchingRuleData =
         new CustomMatchingRuleData("custom", typeof(AlwaysMatchingRule).AssemblyQualifiedName)
         {
             Attributes = { { "foo", "bar" }, { "bar", "baz" } }
         };
 }
 public void Setup()
 {
     matchingRuleData = new TypeMatchingRuleData("type", typeof(object).FullName);
 }
 public void Setup()
 {
     matchingRuleData =
         new TagAttributeMatchingRuleData("tag", "match") { IgnoreCase = true };
 }
 public void Setup()
 {
     matchingRuleData =
         new ReturnTypeMatchingRuleData("returnType", typeof(object).FullName) { IgnoreCase = true };
 }
 public void Setup()
 {
     matchingRuleData =
         new PropertyMatchingRuleData("properties")
         {
             Matches = { 
                 new PropertyMatchData("foo", PropertyMatchingOption.Get, true), 
                 new PropertyMatchData("bar", PropertyMatchingOption.Set,  false) }
         };
 }
 public void Setup()
 {
     matchingRuleData = new AssemblyMatchingRuleData("assembly", typeof(object).Assembly.FullName);
 }
 public void Setup()
 {
     matchingRuleData =
         new ParameterTypeMatchingRuleData("parameters")
         {
             Matches = { 
                 new ParameterTypeMatchData("foo", ParameterKind.Input, true), 
                 new ParameterTypeMatchData("bar", ParameterKind.ReturnValue,  false) }
         };
 }
 public void Setup()
 {
     matchingRuleData =
         new NamespaceMatchingRuleData("namespace")
         {
             Matches = { 
                 new MatchData("foo", true), 
                 new MatchData("bar", false) }
         };
 }
 public void Setup()
 {
     matchingRuleData =
         new MethodSignatureMatchingRuleData("signature", "pattern")
         {
             IgnoreCase = true,
             Parameters = { 
                 new ParameterTypeElement("foo", typeof(object).FullName), 
                 new ParameterTypeElement("bar", typeof(int).FullName) }
         };
 }
 public void Setup()
 {
     matchingRuleData =
         new MemberNameMatchingRuleData(
             "member",
             new[] { new MatchData("foo", true), new MatchData("bar", false) });
 }
 public void Setup()
 {
     matchingRuleData =
         new ParameterTypeMatchingRuleData("parameters")
         {
             Matches = { 
                 new ParameterTypeMatchData(typeof(int).FullName, ParameterKind.Input, true), 
                 new ParameterTypeMatchData(typeof(string).FullName, ParameterKind.ReturnValue,  false) }
         };
 }