public void TestBasePublicMethod() { const string strExpected = "overridden base public method."; var classUnderTest = new ConcreteClass("Public Method Test"); var strActual = classUnderTest.BasePublicMethod(); Assert.AreEqual(strExpected, strActual); }
public void TestGetInstanceField_InvalidMethod() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.GetInstanceField( typeof(ConcreteClass), "_errorName", classUnderTest); }
public void TestGetInstanceField_InvalidType() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.GetInstanceField( typeof(TestBaseClass), "_concreteParameter2", classUnderTest); }
public void TestGetInstanceField_NullMethod() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.GetInstanceField( typeof(ConcreteClass), null, classUnderTest); }
public void SetInstanceProperty_InvalidSetValue() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.SetInstanceProperty( typeof(ConcreteClass), "ConcreteProtectedProperty", classUnderTest, 1, new object[0]); }
public void TestGetInstanceField() { const string strExpected = "default2"; var classUnderTest = new ConcreteClass("Private Field Test"); var objectUnderTest = ReflectionTestHelper.GetInstanceField( typeof(ConcreteClass), "_concreteParameter2", classUnderTest); var strActual = Convert.ToString(objectUnderTest); Assert.AreEqual(strExpected, strActual); }
public void TestGetPrivateProperty() { const string strExpected = "concrete private property. Private Property Test"; var classUnderTest = new ConcreteClass("Private Property Test"); var objectUnderTest = UnitTestUtilities.ReflectionTestHelper.GetInstanceProperty( typeof(ConcreteClass), "ConcretePrivateProperty", classUnderTest, new object[0]); var strActual = Convert.ToString(objectUnderTest); Assert.AreEqual(strExpected, strActual); }
public void TestBaseProtectedInstanceMethod() { const string strExpected = "overriden base protected method."; var classUnderTest = new ConcreteClass("Base Protected Method Test"); var objectUnderTest = UnitTestUtilities.ReflectionTestHelper.RunInstanceMethod( typeof(ConcreteClass), "BaseProtectedMethod", classUnderTest, new object[0]); var strActual = Convert.ToString(objectUnderTest); Assert.AreEqual(strExpected, strActual); }
public void TestSetPrivateField() { const string strExpected = "Setting Value Here"; var classUnderTest = new ConcreteClass("Private Field Test"); var objectUnderTest = UnitTestUtilities.ReflectionTestHelper.SetInstanceField( typeof(ConcreteClass), "_concreteParameter2", classUnderTest, "Setting Value Here"); var strActual = Convert.ToString(objectUnderTest); Assert.AreEqual(strExpected, strActual); }
public void TestRunInstanceMethod_InvalidType() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.RunInstanceMethod( typeof(TestBaseClass), "ConcreteProtectedMethod", classUnderTest, new object[0]); }
public void TestSetInstanceProperty_InvalidType() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.SetInstanceProperty( typeof(TestBaseClass), "ConcreteProtectedProperty", classUnderTest, "Setting Value Here", new object[0]); }
public void TestSetInstanceProperty_NullMethod() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.SetInstanceProperty( typeof(ConcreteClass), null, classUnderTest, "Setting Value Here", new object[0]); }
public void TestSetInstanceField_InvalidSetValue() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.SetInstanceField( typeof(ConcreteClass), "_concreteParameter2", classUnderTest, 1); }
public void TestSetInstanceProperty() { const string strExpected = "concrete protected property. Setting Value Here"; var classUnderTest = new ConcreteClass("Private Field Test"); var objectUnderTest = ReflectionTestHelper.SetInstanceProperty( typeof(ConcreteClass), "ConcreteProtectedProperty", classUnderTest, "Setting Value Here", new object[0]); var strActual = Convert.ToString(objectUnderTest); Assert.AreEqual(strExpected, strActual); }
public void TestRunInstanceMethod() { const string strExpected = "concrete protected method."; var classUnderTest = new ConcreteClass("Protected Method Test"); var objectUnderTest = ReflectionTestHelper.RunInstanceMethod( typeof(ConcreteClass), "ConcreteProtectedMethod", classUnderTest, new object[0]); var strActual = Convert.ToString(objectUnderTest); Assert.AreEqual(strExpected, strActual); }
public void TestRunInstanceMethod_ParamPresent() { var classUnderTest = new ConcreteClass("Protected Property Test"); ReflectionTestHelper.RunInstanceMethod( typeof(ConcreteClass), "ConcreteProtectedMethod", classUnderTest, new object[] { "test", 2 }); }
public void TestRunInstanceMethod_NullMethod() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.RunInstanceMethod( typeof(ConcreteClass), null, classUnderTest, new object[0]); }
public void TestPublicProperty() { const string strExpected = "concrete public property."; var classUnderTest = new ConcreteClass("Public Property Test"); var strActual = classUnderTest.ConcretePublicProperty; Assert.AreEqual(strExpected, strActual); }
public void TestRunInstanceMethod_InvalidMethod() { var classUnderTest = new ConcreteClass("Private Field Test"); ReflectionTestHelper.RunInstanceMethod( typeof(ConcreteClass), "ErrorName", classUnderTest, new object[0]); }