public void CanGetValueFromMethodForInstanceOfDeclaringClass() { MethodInfo methodInfo = typeof(BaseTestDomainObject).GetMethod("Method1"); ValueAccess valueAccess = new MethodValueAccess(methodInfo); BaseTestDomainObject domainObject = new BaseTestDomainObject(); object value; string valueAccessRetrievalFailure; bool status = valueAccess.GetValue(domainObject, out value, out valueAccessRetrievalFailure); Assert.IsTrue(status); Assert.AreEqual(BaseTestDomainObject.Base1Value, value); }
public void CanGetValueFromPropertyForInstanceOfDeclaringClass() { PropertyInfo propertyInfo = typeof(BaseTestDomainObject).GetProperty("Property1"); ValueAccess valueAccess = new PropertyValueAccess(propertyInfo); BaseTestDomainObject domainObject = new BaseTestDomainObject(); object value; string valueAccessRetrievalFailure; bool status = valueAccess.GetValue(domainObject, out value, out valueAccessRetrievalFailure); Assert.IsTrue(status); Assert.AreEqual(BaseTestDomainObject.Base1Value, value); }