Exemple #1
0
            public void ReturnsFalseForNonExistingMember()
            {
                var adapter = new ReflectionObjectAdapter();
                var model   = new TestClassWithRegularMembers();

                Assert.IsFalse(adapter.SetMemberValue(model, "NotExistingMember", "John"));
            }
Exemple #2
0
            public void SetsFieldValue()
            {
                var adapter = new ReflectionObjectAdapter();
                var model   = new TestClassWithRegularMembers();

                Assert.IsTrue(adapter.SetMemberValue(model, nameof(TestClassWithRegularMembers.StringField), "John"));
                Assert.AreEqual("John", model.StringField);
            }
Exemple #3
0
            public void SetsCatelModelPropertyValue()
            {
                var adapter = new ReflectionObjectAdapter();
                var model   = new PersonTestModel();

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