示例#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.");
		}