示例#1
0
        public void MethodTest()
        {
            dynamic exposed  = Exposed.New(Type.GetType("TestSubjects.HiddenClass, TestSubjects"));
            string  password = exposed.GeneratePassword(8);

            Assert.Equal(password, exposed.Password);
        }
示例#2
0
        public void MethodTest()
        {
            dynamic exposed  = Exposed.New(Type.GetType("TestSubjects.GenericMethodClass, TestSubjects"));
            string  password = exposed.Mangle <string, int>("test", 8);

            Assert.Equal("test8", password);
        }
        public void MismatchedMethodTest()
        {
            dynamic exposed  = Exposed.New(Type.GetType("TestSubjects.GenericMethodClass, TestSubjects"));
            string  password = exposed.Mangle <int, int>("test", 8);

            Assert.Fail("Mismatched generic parameters, invocation should fail.");
        }
示例#4
0
        public void MethodTest()
        {
            dynamic exposed  = Exposed.New(typeof(ClassWithHiddenMethods));
            string  password = exposed.GeneratePassword(8);

            Assert.AreEqual(password, exposed.Password);
        }
示例#5
0
        public void PropertyTest()
        {
            dynamic exposed = Exposed.New(Type.GetType("TestSubjects.HiddenClass, TestSubjects"));
            int     count   = exposed.Countz;

            Assert.Equal(0, count);

            exposed.Countz = 9;
            count          = exposed.Countz;
            Assert.Equal(9, count);
        }
示例#6
0
        public void FieldTest()
        {
            dynamic exposed  = Exposed.New(Type.GetType("TestSubjects.HiddenClass, TestSubjects"));
            string  password = exposed.password;

            Assert.Null(password);

            exposed.password = "******";
            password         = exposed.password;
            Assert.Equal("TestValue", password);
        }
示例#7
0
        public void OverloadResolutionTest()
        {
            dynamic exposed = Exposed.New(Type.GetType("TestSubjects.OverloadedMethodsClass, TestSubjects"));

            string password = exposed.SuperMethod();

            Assert.AreEqual("SuperMethod", password);

            password = exposed.SuperMethod(3);
            Assert.AreEqual("SuperMethod_int", password);

            password = exposed.SuperMethod("string");
            Assert.AreEqual("SuperMethod_string", password);
        }
示例#8
0
        public void MismatchedMethodTest()
        {
            dynamic exposed = Exposed.New(Type.GetType("TestSubjects.GenericMethodClass, TestSubjects"));

            Assert.Throws <ArgumentException>(() => exposed.Mangle <int, int>("test", 8));
        }