public void InstantiationViaSerialization()
	    {
	    	SdkRegularExpressionMethodPointcut initial = new SdkRegularExpressionMethodPointcut();
            initial.Pattern = "Foo";
	    	SdkRegularExpressionMethodPointcut pcut = (SdkRegularExpressionMethodPointcut) SerializationTestUtils.SerializeAndDeserialize(initial);
            Assert.IsNotNull(pcut, "Deserialized instance must (obviously) not be null.");
            Assert.AreEqual(initial.Pattern, pcut.Pattern, "Pattern property not deserialized correctly.");
        }
 public void TryMatchesAfterSerialization()
 {
 	SdkRegularExpressionMethodPointcut initial = new SdkRegularExpressionMethodPointcut();
     initial.Pattern = "Foo";
 	SdkRegularExpressionMethodPointcut pcut = (SdkRegularExpressionMethodPointcut) SerializationTestUtils.SerializeAndDeserialize(initial);
     Assert.IsNotNull(pcut, "Deserialized instance must (obviously) not be null.");
     Type type = GetType();
     bool isMatch = pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type);
     Assert.IsFalse(isMatch, "Whoops, should not be matching here at all.");
 }
        public void InstantiationViaSerialization()
        {
            SdkRegularExpressionMethodPointcut initial = new SdkRegularExpressionMethodPointcut();

            initial.Pattern = "Foo";
            SdkRegularExpressionMethodPointcut pcut = (SdkRegularExpressionMethodPointcut)SerializationTestUtils.SerializeAndDeserialize(initial);

            Assert.IsNotNull(pcut, "Deserialized instance must (obviously) not be null.");
            Assert.AreEqual(initial.Pattern, pcut.Pattern, "Pattern property not deserialized correctly.");
        }
        public void TryMatchesAfterSerialization()
        {
            SdkRegularExpressionMethodPointcut initial = new SdkRegularExpressionMethodPointcut();

            initial.Pattern = "Foo";
            SdkRegularExpressionMethodPointcut pcut = (SdkRegularExpressionMethodPointcut)SerializationTestUtils.SerializeAndDeserialize(initial);

            Assert.IsNotNull(pcut, "Deserialized instance must (obviously) not be null.");
            Type type    = GetType();
            bool isMatch = pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type);

            Assert.IsFalse(isMatch, "Whoops, should not be matching here at all.");
        }
        public void MixedPatternsAndDefaultOptions()
        {
            Type type = GetType();
            SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();

            pcut.DefaultOptions = RegexOptions.None;
            pcut.Patterns       = new object[] { "forMatching*", new Regex("xyz*", RegexOptions.Compiled) };
            Assert.IsFalse(pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type));

            pcut.DefaultOptions = RegexOptions.IgnoreCase;
            pcut.Patterns       = new object[] { "forMatching*", new Regex("xyz*", RegexOptions.Compiled) };
            Assert.IsTrue(pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type));

            pcut.DefaultOptions = RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace;
            pcut.Patterns       = new object[] { "for matc \nhing*", new Regex("xyz*", RegexOptions.Compiled) };
            Assert.IsTrue(pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type));
        }
        public void MixedPatternsAndDefaultOptions()
	    {
            Type type = GetType();
            SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();

	        pcut.DefaultOptions = RegexOptions.None;
            pcut.Patterns = new object[] {"forMatching*", new Regex("xyz*", RegexOptions.Compiled)};
            Assert.IsFalse(pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type));
            
	        pcut.DefaultOptions = RegexOptions.IgnoreCase;
            pcut.Patterns = new object[] { "forMatching*", new Regex("xyz*", RegexOptions.Compiled) };
            Assert.IsTrue(pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type));

	        pcut.DefaultOptions = RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace;
            pcut.Patterns = new object[] { "for matc \nhing*", new Regex("xyz*", RegexOptions.Compiled) };
            Assert.IsTrue(pcut.Matches(type.GetMethod("ForMatchingPurposesOnly"), type));
        }
	    public void InstantiationWithSuppliedPattern()
	    {
	    	SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut("Foo");
            Assert.AreEqual("Foo", pcut.Pattern, "Pattern supplied via the ctor was not set.");
	    }
 public void SetPatternsPluralToStringArrayWithNullValue()
 {
 	SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();
     Assert.Throws<ArgumentNullException>(() => pcut.Patterns = new string[] { null });
 }
 public void SetPatternsPluralToNull()
 {
 	SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();
     Assert.Throws<ArgumentNullException>(() => pcut.Patterns = null);
 }
 public void SetPatternsPluralToStringArrayWithNullValue()
 {
 	SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();
     pcut.Patterns = new string[] { null };
 }
 public void SetPatternsPluralToNull()
 {
 	SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();
     pcut.Patterns = null;
 }
        public void InstantiationWithSuppliedPattern()
        {
            SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut("Foo");

            Assert.AreEqual("Foo", pcut.Pattern, "Pattern supplied via the ctor was not set.");
        }
        public void SetPatternsPluralToStringArrayWithNullValue()
        {
            SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();

            pcut.Patterns = new string[] { null };
        }
        public void SetPatternsPluralToNull()
        {
            SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();

            pcut.Patterns = null;
        }
        public void SetPatternsPluralToStringArrayWithNullValue()
        {
            SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();

            Assert.Throws <ArgumentNullException>(() => pcut.Patterns = new string[] { null });
        }
        public void SetPatternsPluralToNull()
        {
            SdkRegularExpressionMethodPointcut pcut = new SdkRegularExpressionMethodPointcut();

            Assert.Throws <ArgumentNullException>(() => pcut.Patterns = null);
        }