Пример #1
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.");
        }
Пример #2
0
        public void TestEventTester( )
        {
            Obfuscar.TypeKey  typeKey = new Obfuscar.TypeKey("anything", "ns", "name");
            Obfuscar.EventKey key     = new Obfuscar.EventKey(typeKey, "type", "event");

            Obfuscar.IPredicate <Obfuscar.EventKey> tester;

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

            // check differnt kinds of type name
            tester = new Obfuscar.EventTester("event", "ns.n*e", "any");
            Assert.IsTrue(tester.Test(key), "Tester should handle type wildcards.");
            tester = new Obfuscar.EventTester("event", "^ns\\.n.*e", "any");
            Assert.IsTrue(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.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.");
		}
Пример #4
0
		public void TestEventTester( )
		{
			Obfuscar.TypeKey typeKey = new Obfuscar.TypeKey( "anything", "ns", "name" );
			Obfuscar.EventKey key = new Obfuscar.EventKey( typeKey, "type", "event" );

			Obfuscar.IPredicate<Obfuscar.EventKey> tester;

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

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