Esempio n. 1
0
        public void CanSetPrivateFieldIninstanceOfObject()
        {
            Person p = new Person();
            SetInstanceFieldValue(p, PERSON_TEST_FIELD_NAME, PERSON_TEST_FIELD_VALUE);
            Assert.AreEqual(PERSON_TEST_FIELD_VALUE, p.Firstname);

        }
Esempio n. 2
0
        public void CanThrowExceptionOnFieldnameNotFoundInObject()
        {
            try
            {
                Person p = new Person();
                SetInstanceFieldValue(p, String.Format("{0}zzz", PERSON_TEST_FIELD_NAME), PERSON_TEST_FIELD_VALUE);
                Assert.Fail("Expected Exception of type 'InvalidOperationException 'not thrown.");
            }
            catch (ArgumentException)
            {

            }

        }
Esempio n. 3
0
        public void CanThrowExceptionWhenSettingFieldToInvalidType()
        {

            try
            {
                Person p = new Person();
                SetInstanceFieldValue(p, PERSON_TEST_FIELD_NAME, new Person());
                Assert.Fail("Expected Exception of type 'ArgumentException' not thrown.");
            }
            catch (ArgumentException)
            {

            }

        }
Esempio n. 4
0
 public void CanGetPrivateFieldInInstanceOfObject()
 {
     Person p = new Person { Firstname = PERSON_TEST_FIELD_VALUE };
     Assert.AreEqual(PERSON_TEST_FIELD_VALUE, GetInstanceFieldValue(p, PERSON_TEST_FIELD_NAME));
 }