public void MethodTest() { dynamic exposed = Exposed.New(Type.GetType("TestSubjects.HiddenClass, TestSubjects")); string password = exposed.GeneratePassword(8); Assert.Equal(password, exposed.Password); }
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."); }
public void MethodTest() { dynamic exposed = Exposed.New(typeof(ClassWithHiddenMethods)); string password = exposed.GeneratePassword(8); Assert.AreEqual(password, exposed.Password); }
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); }
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); }
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); }
public void MismatchedMethodTest() { dynamic exposed = Exposed.New(Type.GetType("TestSubjects.GenericMethodClass, TestSubjects")); Assert.Throws <ArgumentException>(() => exposed.Mangle <int, int>("test", 8)); }