public void GetPropertyValue_GivenPropertyDoesNotExist_ShouldThrowException() { //---------------Set up test pack------------------- var fakeReflection = new FakeReflection(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var exception = Assert.Throws <ArgumentException>(() => fakeReflection.GetPropertyValue("InvalidProperty")); //---------------Test Result ----------------------- StringAssert.Contains("Property [InvalidProperty] does not exist on object", exception.Message); }
public void GetPropertyValue_GivenPropertyExists_ShouldReturnPropertyValue() { //---------------Set up test pack------------------- var newTestValue = "Test Value"; var fakeReflection = new FakeReflection { ValidProperty = newTestValue }; //---------------Assert Precondition---------------- Assert.AreEqual(newTestValue, fakeReflection.ValidProperty); //---------------Execute Test ---------------------- var result = fakeReflection.GetPropertyValue("ValidProperty"); //---------------Test Result ----------------------- Assert.AreEqual(newTestValue, result); }