コード例 #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.");
        }
コード例 #2
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.");
        }
コード例 #3
0
        public void TestEventTester()
        {
            Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey("anything", "ns", "name");
            var mock = new TypeReference(string.Empty, "type", null, null);

            Obfuscar.EventKey key = new Obfuscar.EventKey(typeKey, "type", "event", new EventDefinition("event", EventAttributes.None, mock));

            Obfuscar.IPredicate <Obfuscar.EventKey> tester;

            // check differnt kinds of name
            tester = new Obfuscar.EventTester("event", "ns.name", "", "");
            Assert.True(tester.Test(key), "Tester should handle strings.");
            tester = new Obfuscar.EventTester("e*t", "ns.name", "", "");
            Assert.True(tester.Test(key), "Tester should handle wildcards.");
            tester = new Obfuscar.EventTester("^e.*t", "ns.name", "", "");
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");
            tester = new Obfuscar.EventTester(new Regex("e.*t"), "ns.name", "", "");
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");

            // check differnt kinds of type name
            tester = new Obfuscar.EventTester("event", "ns.n*e", "", "");
            Assert.True(tester.Test(key), "Tester should handle type wildcards.");
            tester = new Obfuscar.EventTester("event", "^ns\\.n.*e", "", "");
            Assert.True(tester.Test(key), "Tester should handle type regular expressions.");
        }
コード例 #4
0
ファイル: TesterTests.cs プロジェクト: jerryhuffman/obfuscar
		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.");
		}
コード例 #5
0
        public void TestFieldTester()
        {
            Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey("anything", "ns", "name");
            var mock = new TypeReference(string.Empty, "type", null, null);

            Obfuscar.FieldKey key = new Obfuscar.FieldKey(typeKey, "type", "field", new FieldDefinition("field", FieldAttributes.Public, mock)
            {
                DeclaringType = new TypeDefinition(string.Empty, "type", TypeAttributes.Public)
            });

            Obfuscar.IPredicate <Obfuscar.FieldKey> tester;

            // check differnt kinds of name
            tester = new Obfuscar.FieldTester("field", "ns.name", "", "", "", "", false, false);
            Assert.True(tester.Test(key), "Tester should handle strings.");
            tester = new Obfuscar.FieldTester("f*d", "ns.name", "", "", "", "", false, false);
            Assert.True(tester.Test(key), "Tester should handle wildcards.");
            tester = new Obfuscar.FieldTester("^f.*d", "ns.name", "", "", "", "", false, false);
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");
            tester = new Obfuscar.FieldTester(new Regex("f.*d"), "ns.name", "", "", "", "", false, false);
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");

            // check differnt kinds of type name
            tester = new Obfuscar.FieldTester("field", "ns.n*e", "", "", "", "", false, false);
            Assert.True(tester.Test(key), "Tester should handle type wildcards.");
            tester = new Obfuscar.FieldTester("field", "^ns\\.n.*e", "", "", "", "", false, false);
            Assert.True(tester.Test(key), "Tester should handle type regular expressions.");
        }
コード例 #6
0
ファイル: TesterTests.cs プロジェクト: remobjects/Obfuscar
        public void TestTypeTester()
        {
            Obfuscar.TypeKey key = new Obfuscar.TypeKey ("anything", "ns", "name");

            Obfuscar.IPredicate<Obfuscar.TypeKey> tester;

            tester = new Obfuscar.TypeTester ("ns.name");
            Assert.IsTrue (tester.Test (key), "Tester should handle strings.");
            tester = new Obfuscar.TypeTester ("ns.n*e");
            Assert.IsTrue (tester.Test (key), "Tester should handle wildcards.");
            tester = new Obfuscar.TypeTester ("^ns\\.n.*e");
            Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");
        }
コード例 #7
0
        public void TestTypeTester()
        {
            Obfuscar.TypeKey key = new Obfuscar.TypeKey("anything", "ns", "name");

            Obfuscar.IPredicate <Obfuscar.TypeKey> tester;

            tester = new Obfuscar.TypeTester("ns.name");
            Assert.True(tester.Test(key), "Tester should handle strings.");
            tester = new Obfuscar.TypeTester("ns.n*e");
            Assert.True(tester.Test(key), "Tester should handle wildcards.");
            tester = new Obfuscar.TypeTester("^ns\\.n.*e");
            Assert.True(tester.Test(key), "Tester should handle regular expressions.");
        }
コード例 #8
0
ファイル: TesterTests.cs プロジェクト: ossecsoft/obfuscar
        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.");
        }
コード例 #9
0
ファイル: TesterTests.cs プロジェクト: ossecsoft/obfuscar
        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.");
        }
コード例 #10
0
ファイル: TesterTests.cs プロジェクト: nyxiscoo1/obfuscar
		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." );
		}
コード例 #11
0
ファイル: TesterTests.cs プロジェクト: nyxiscoo1/obfuscar
		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." );
		}
コード例 #12
0
ファイル: TesterTests.cs プロジェクト: jerryhuffman/obfuscar
		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.IsTrue (tester.Test (key), "Tester should handle strings.");
			tester = new Obfuscar.MethodTester ("me*od", "ns.name", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle wildcards.");
			tester = new Obfuscar.MethodTester ("^me.*od", "ns.name", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");
			tester = new Obfuscar.MethodTester (new Regex ("me.*od"), "ns.name", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");

			// check differnt kinds of type name
			tester = new Obfuscar.MethodTester ("method", "ns.n*e", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle type wildcards.");
			tester = new Obfuscar.MethodTester ("method", "^ns\\.n.*e", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle type regular expressions.");
		}
コード例 #13
0
ファイル: TesterTests.cs プロジェクト: jerryhuffman/obfuscar
		public void TestEventTester ()
		{
			Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey ("anything", "ns", "name");
			var mock = new TypeReference (string.Empty, "type", null, null);
			Obfuscar.EventKey key = new Obfuscar.EventKey (typeKey, "type", "event", new EventDefinition ("event", EventAttributes.None, mock));

			Obfuscar.IPredicate<Obfuscar.EventKey> tester;

			// check differnt kinds of name
			tester = new Obfuscar.EventTester ("event", "ns.name", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle strings.");
			tester = new Obfuscar.EventTester ("e*t", "ns.name", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle wildcards.");
			tester = new Obfuscar.EventTester ("^e.*t", "ns.name", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");
			tester = new Obfuscar.EventTester (new Regex ("e.*t"), "ns.name", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");

			// check differnt kinds of type name
			tester = new Obfuscar.EventTester ("event", "ns.n*e", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle type wildcards.");
			tester = new Obfuscar.EventTester ("event", "^ns\\.n.*e", "", "");
			Assert.IsTrue (tester.Test (key), "Tester should handle type regular expressions.");
		}
コード例 #14
0
ファイル: TesterTests.cs プロジェクト: jerryhuffman/obfuscar
		public void TestFieldTester ()
		{
			Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey ("anything", "ns", "name");
			var mock = new TypeReference (string.Empty, "type", null, null);
			Obfuscar.FieldKey key = new Obfuscar.FieldKey (typeKey, "type", "field", new FieldDefinition ("field", FieldAttributes.Public, mock) {
				DeclaringType = new TypeDefinition (string.Empty, "type", TypeAttributes.Public)
			});

			Obfuscar.IPredicate<Obfuscar.FieldKey> tester;

			// check differnt kinds of name
			tester = new Obfuscar.FieldTester ("field", "ns.name", "", "", "", "", false, false);
			Assert.IsTrue (tester.Test (key), "Tester should handle strings.");
			tester = new Obfuscar.FieldTester ("f*d", "ns.name", "", "", "", "", false, false);
			Assert.IsTrue (tester.Test (key), "Tester should handle wildcards.");
			tester = new Obfuscar.FieldTester ("^f.*d", "ns.name", "", "", "", "", false, false);
			Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");
			tester = new Obfuscar.FieldTester (new Regex ("f.*d"), "ns.name", "", "", "", "", false, false);
			Assert.IsTrue (tester.Test (key), "Tester should handle regular expressions.");

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