public void CanGetValueFromOverridenMethodForInstanceOfDerivedClass()
        {
            MethodInfo methodInfo = typeof(BaseTestDomainObject).GetMethod("Method2");
            ValueAccess valueAccess = new MethodValueAccess(methodInfo);
            BaseTestDomainObject domainObject = new DerivedTestDomainObject();

            object value;
            string valueAccessRetrievalFailure;
            bool status = valueAccess.GetValue(domainObject, out value, out valueAccessRetrievalFailure);

            Assert.IsTrue(status);
            Assert.AreEqual(DerivedTestDomainObject.Derived2Value, value);
        }
        public void RetrievalOfValueForInstanceOfDerivedTypeThroughBaseAliasedMethodReturnsValueFromInheritedMethod()
        {
            MethodInfo methodInfo = typeof(BaseTestDomainObject).GetMethod("Method3");
            ValueAccess valueAccess = new MethodValueAccess(methodInfo);
            BaseTestDomainObject domainObject = new DerivedTestDomainObject();

            object value;
            string valueAccessRetrievalFailure;
            bool status = valueAccess.GetValue(domainObject, out value, out valueAccessRetrievalFailure);

            Assert.IsTrue(status);
            Assert.AreEqual(BaseTestDomainObject.Base3Value, value);
        }
        public void RetrievalOfValueForInstanceOfNonRelatedTypeReturnsFailure()
        {
            MethodInfo methodInfo = typeof(BaseTestDomainObject).GetMethod("Method1");
            ValueAccess valueAccess = new MethodValueAccess(methodInfo);

            object value;
            string valueAccessRetrievalFailure;
            bool status = valueAccess.GetValue("a string", out value, out valueAccessRetrievalFailure);

            Assert.IsFalse(status);
            Assert.IsNull(value);
            Assert.IsTrue(TemplateStringTester.IsMatch(Resources.ErrorValueAccessInvalidType, valueAccessRetrievalFailure));
        }
        public void CanGetKeyFromValueAccess()
        {
            MethodInfo methodInfo = typeof(BaseTestDomainObject).GetMethod("Method3");
            ValueAccess valueAccess = new MethodValueAccess(methodInfo);

            Assert.AreEqual("Method3", valueAccess.Key);
        }