Ejemplo n.º 1
0
        public void TestPropertyTester()
        {
            Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey("anything", "ns", "name");
            var mock = new TypeReference(string.Empty, "type", null, null);

            Obfuscar.PropertyKey key = new Obfuscar.PropertyKey(typeKey, new PropertyDefinition("property", PropertyAttributes.None, mock)
            {
                GetMethod = new MethodDefinition("get_property", MethodAttributes.Public, mock)
            });

            Obfuscar.IPredicate <Obfuscar.PropertyKey> tester;

            // check differnt kinds of name
            tester = new Obfuscar.PropertyTester("property", "ns.name", "public", null);
            Assert.True(tester.Test(key), "Tester should handle strings.");
            tester = new Obfuscar.PropertyTester("pr*ty", "ns.name", "public", null);
            Assert.True(tester.Test(key), "Tester should handle wildcards.");
            tester = new Obfuscar.PropertyTester("^pr.*ty", "ns.name", "public", null);
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");
            tester = new Obfuscar.PropertyTester(new Regex("p.*y"), "ns.name", "public", null);
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");

            // check differnt kinds of type name
            tester = new Obfuscar.PropertyTester("property", "ns.n*e", "public", null);
            Assert.True(tester.Test(key), "Tester should handle type wildcards.");
            tester = new Obfuscar.PropertyTester("property", "^ns\\.n.*e", "public", null);
            Assert.True(tester.Test(key), "Tester should handle type regular expressions.");
        }
Ejemplo n.º 2
0
		public void TestPropertyTester ()
		{
			Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey ("anything", "ns", "name");
			var mock = new TypeReference (string.Empty, "type", null, null);
			Obfuscar.PropertyKey key = new Obfuscar.PropertyKey (typeKey, new PropertyDefinition ("property", PropertyAttributes.None, mock) {
				GetMethod = new MethodDefinition ("get_property", MethodAttributes.Public, mock)
			});

			Obfuscar.IPredicate<Obfuscar.PropertyKey> tester;

			// check differnt kinds of name
			tester = new Obfuscar.PropertyTester ("property", "ns.name", "public", null);
			Assert.IsTrue (tester.Test (key), "Tester should handle strings.");
			tester = new Obfuscar.PropertyTester ("pr*ty", "ns.name", "public", null);
			Assert.IsTrue (tester.Test (key), "Tester should handle wildcards.");
			tester = new Obfuscar.PropertyTester ("^pr.*ty", "ns.name", "public", null);
			Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");
			tester = new Obfuscar.PropertyTester (new Regex ("p.*y"), "ns.name", "public", null);
			Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");

			// check differnt kinds of type name
			tester = new Obfuscar.PropertyTester ("property", "ns.n*e", "public", null);
			Assert.IsTrue (tester.Test (key), "Tester should handle type wildcards.");
			tester = new Obfuscar.PropertyTester ("property", "^ns\\.n.*e", "public", null);
			Assert.IsTrue (tester.Test (key), "Tester should handle type regular expressions.");
		}
Ejemplo n.º 3
0
        public void TestPropertyTester( )
        {
            Obfuscar.TypeKey     typeKey = new Obfuscar.TypeKey("anything", "ns", "name");
            Obfuscar.PropertyKey key     = new Obfuscar.PropertyKey(typeKey, "type", "property");

            Obfuscar.IPredicate <Obfuscar.PropertyKey> tester;

            // check differnt kinds of name
            tester = new Obfuscar.PropertyTester("property", "ns.name", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle strings.");
            tester = new Obfuscar.PropertyTester("pr*ty", "ns.name", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle wildcards.");
            tester = new Obfuscar.PropertyTester("^pr.*ty", "ns.name", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle regular expressions.");
            tester = new Obfuscar.PropertyTester(new Regex("p.*y"), "ns.name", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle regular expressions.");

            // check differnt kinds of type name
            tester = new Obfuscar.PropertyTester("property", "ns.n*e", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle type wildcards.");
            tester = new Obfuscar.PropertyTester("property", "^ns\\.n.*e", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle type regular expressions.");
        }
Ejemplo n.º 4
0
		public void TestPropertyTester( )
		{
			Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey( "anything", "ns", "name" );
			Obfuscar.PropertyKey key = new Obfuscar.PropertyKey( typeKey, "type", "property" );

			Obfuscar.IPredicate<Obfuscar.PropertyKey> tester;

			// check differnt kinds of name
			tester = new Obfuscar.PropertyTester( "property", "ns.name", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle strings." );
			tester = new Obfuscar.PropertyTester( "pr*ty", "ns.name", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle wildcards." );
			tester = new Obfuscar.PropertyTester( "^pr.*ty", "ns.name", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle regular expressions." );
			tester = new Obfuscar.PropertyTester( new Regex( "p.*y" ), "ns.name", "any" );
			Assert.IsTrue( tester.Test( key ), "Tester should handle regular expressions." );

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