コード例 #1
0
 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);
 }
コード例 #2
0
 public void TestGetInstanceField_InvalidMethod()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.GetInstanceField(
          typeof(ConcreteClass),
         "_errorName",
         classUnderTest);
 }
コード例 #3
0
 public void TestGetInstanceField_InvalidType()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.GetInstanceField(
          typeof(TestBaseClass),
         "_concreteParameter2",
         classUnderTest);
 }
コード例 #4
0
 public void TestGetInstanceField_NullMethod()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.GetInstanceField(
          typeof(ConcreteClass),
         null,
         classUnderTest);
 }
コード例 #5
0
 public void SetInstanceProperty_InvalidSetValue()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.SetInstanceProperty(
          typeof(ConcreteClass),
         "ConcreteProtectedProperty",
         classUnderTest,
         1,
         new object[0]);
 }
コード例 #6
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);
 }
コード例 #7
0
 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);
 }
コード例 #8
0
 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);
 }
コード例 #9
0
 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);
 }
コード例 #10
0
 public void TestRunInstanceMethod_InvalidType()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.RunInstanceMethod(
          typeof(TestBaseClass),
         "ConcreteProtectedMethod",
         classUnderTest,
         new object[0]);
 }
コード例 #11
0
 public void TestSetInstanceProperty_InvalidType()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.SetInstanceProperty(
          typeof(TestBaseClass),
         "ConcreteProtectedProperty",
         classUnderTest,
         "Setting Value Here",
         new object[0]);
 }
コード例 #12
0
 public void TestSetInstanceProperty_NullMethod()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.SetInstanceProperty(
          typeof(ConcreteClass),
         null,
         classUnderTest,
         "Setting Value Here",
         new object[0]);
 }
コード例 #13
0
 public void TestSetInstanceField_InvalidSetValue()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.SetInstanceField(
          typeof(ConcreteClass),
         "_concreteParameter2",
         classUnderTest,
         1);
 }
コード例 #14
0
 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);
 }
コード例 #15
0
 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);
 }
コード例 #16
0
 public void TestRunInstanceMethod_ParamPresent()
 {
     var classUnderTest = new ConcreteClass("Protected Property Test");
     ReflectionTestHelper.RunInstanceMethod(
          typeof(ConcreteClass),
         "ConcreteProtectedMethod",
         classUnderTest,
         new object[] { "test", 2 });
 }
コード例 #17
0
 public void TestRunInstanceMethod_NullMethod()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.RunInstanceMethod(
          typeof(ConcreteClass),
         null,
         classUnderTest,
         new object[0]);
 }
コード例 #18
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);
 }
コード例 #19
0
 public void TestRunInstanceMethod_InvalidMethod()
 {
     var classUnderTest = new ConcreteClass("Private Field Test");
     ReflectionTestHelper.RunInstanceMethod(
          typeof(ConcreteClass),
         "ErrorName",
         classUnderTest,
         new object[0]);
 }