예제 #1
0
        public void TestMethodTester()
        {
            Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey("anything", "ns", "name");
            var mock = new TypeReference(string.Empty, "type", null, null);

            Obfuscar.MethodKey key = new Obfuscar.MethodKey(typeKey, new MethodDefinition("method", MethodAttributes.Public, mock));

            Obfuscar.IPredicate <Obfuscar.MethodKey> tester;

            // check differnt kinds of name
            tester = new Obfuscar.MethodTester("method", "ns.name", "", "");
            Assert.True(tester.Test(key), "Tester should handle strings.");
            tester = new Obfuscar.MethodTester("me*od", "ns.name", "", "");
            Assert.True(tester.Test(key), "Tester should handle wildcards.");
            tester = new Obfuscar.MethodTester("^me.*od", "ns.name", "", "");
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");
            tester = new Obfuscar.MethodTester(new Regex("me.*od"), "ns.name", "", "");
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");

            // check differnt kinds of type name
            tester = new Obfuscar.MethodTester("method", "ns.n*e", "", "");
            Assert.True(tester.Test(key), "Tester should handle type wildcards.");
            tester = new Obfuscar.MethodTester("method", "^ns\\.n.*e", "", "");
            Assert.True(tester.Test(key), "Tester should handle type regular expressions.");
        }
예제 #2
0
        public void TestMethodTester( )
        {
            Obfuscar.TypeKey   typeKey = new Obfuscar.TypeKey("anything", "ns", "name");
            Obfuscar.MethodKey key     = new Obfuscar.MethodKey(typeKey, "method", new string[0]);

            Obfuscar.IPredicate <Obfuscar.MethodKey> tester;

            // check differnt kinds of name
            tester = new Obfuscar.MethodTester("method", "ns.name", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle strings.");
            tester = new Obfuscar.MethodTester("me*od", "ns.name", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle wildcards.");
            tester = new Obfuscar.MethodTester("^me.*od", "ns.name", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle regular expressions.");
            tester = new Obfuscar.MethodTester(new Regex("me.*od"), "ns.name", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle regular expressions.");

            // check differnt kinds of type name
            tester = new Obfuscar.MethodTester("method", "ns.n*e", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle type wildcards.");
            tester = new Obfuscar.MethodTester("method", "^ns\\.n.*e", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle type regular expressions.");
        }
예제 #3
0
		public void TestMethodTester( )
		{
			Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey( "anything", "ns", "name" );
			Obfuscar.MethodKey key = new Obfuscar.MethodKey( typeKey, "method", new string[0] );

			Obfuscar.IPredicate<Obfuscar.MethodKey> tester;

			// check differnt kinds of name
			tester = new Obfuscar.MethodTester( "method", "ns.name", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle strings." );
			tester = new Obfuscar.MethodTester( "me*od", "ns.name", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle wildcards." );
			tester = new Obfuscar.MethodTester( "^me.*od", "ns.name", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle regular expressions." );
			tester = new Obfuscar.MethodTester( new Regex( "me.*od" ), "ns.name", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle regular expressions." );

			// check differnt kinds of type name
			tester = new Obfuscar.MethodTester( "method", "ns.n*e", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle type wildcards." );
			tester = new Obfuscar.MethodTester( "method", "^ns\\.n.*e", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle type regular expressions." );
		}
예제 #4
0
		public void TestMethodTester ()
		{
			Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey ("anything", "ns", "name");
			var mock = new TypeReference (string.Empty, "type", null, null);
			Obfuscar.MethodKey key = new Obfuscar.MethodKey (typeKey, new MethodDefinition ("method", MethodAttributes.Public, mock));

			Obfuscar.IPredicate<Obfuscar.MethodKey> tester;

			// check differnt kinds of name
			tester = new Obfuscar.MethodTester ("method", "ns.name", "", "");
			Assert.True (tester.Test (key), "Tester should handle strings.");
			tester = new Obfuscar.MethodTester ("me*od", "ns.name", "", "");
			Assert.True (tester.Test (key), "Tester should handle wildcards.");
			tester = new Obfuscar.MethodTester ("^me.*od", "ns.name", "", "");
			Assert.True (tester.Test (key), "Tester should handle regular expressions.");
			tester = new Obfuscar.MethodTester (new Regex ("me.*od"), "ns.name", "", "");
			Assert.True (tester.Test (key), "Tester should handle regular expressions.");

			// check differnt kinds of type name
			tester = new Obfuscar.MethodTester ("method", "ns.n*e", "", "");
			Assert.True (tester.Test (key), "Tester should handle type wildcards.");
			tester = new Obfuscar.MethodTester ("method", "^ns\\.n.*e", "", "");
			Assert.True (tester.Test (key), "Tester should handle type regular expressions.");
		}