Exemplo n.º 1
0
            public void ReturnsFalseForNonExistingMember()
            {
                var    adapter = new ExpressionTreeObjectAdapter();
                var    model   = new TestClassWithRegularMembers();
                string value   = string.Empty;

                Assert.IsFalse(adapter.GetMemberValue(model, "NotExistingMember", out value));
            }
Exemplo n.º 2
0
            public void GetsFieldValue()
            {
                var adapter = new ExpressionTreeObjectAdapter();
                var model   = new TestClassWithRegularMembers
                {
                    StringField = "John"
                };

                string value = string.Empty;

                Assert.IsTrue(adapter.GetMemberValue(model, nameof(TestClassWithRegularMembers.StringField), out value));
                Assert.AreEqual("John", value);
            }
Exemplo n.º 3
0
            public void GetsCatelModelPropertyValue()
            {
                var adapter = new ExpressionTreeObjectAdapter();
                var model   = new PersonTestModel
                {
                    FirstName = "John"
                };

                string value = string.Empty;

                Assert.IsTrue(adapter.GetMemberValue(model, nameof(PersonTestModel.FirstName), out value));
                Assert.AreEqual("John", model.FirstName);
            }