Exemplo n.º 1
0
        public void SetValueCaseInsensitiveOk()
        {
            // create test object
            TestObj test = new TestObj();

            // test setting field
            {
                Mirrors.Mirrors.Set(test, "Int_fielD", 999, true);
                Assert.AreEqual(999, test.int_field);
            }

            // test setting property with read / write
            {
                Mirrors.Mirrors.Set(test, "Int_propertY_rw", 999, true);
                Assert.AreEqual(999, test.int_property_rw);
            }

            // test setting property with just write
            {
                Mirrors.Mirrors.Set(test, "Int_propertY_w", 999, true);
                Assert.AreEqual(999, test.int_property_rw);
            }
        }
Exemplo n.º 2
0
        public void GetValueCaseInsensitiveOk()
        {
            // create test object
            TestObj test = new TestObj();

            // test getting field
            {
                int gotVal = Mirrors.Mirrors.Get <int>(test, "inT_fielD", true);
                Assert.AreEqual(gotVal, test.int_field);
            }

            // test getting property with read / write
            {
                int gotVal = Mirrors.Mirrors.Get <int>(test, "inT_propertY_rw", true);
                Assert.AreEqual(gotVal, test.int_property_rw);
            }

            // test getting property with just read
            {
                int gotVal = Mirrors.Mirrors.Get <int>(test, "inT_propertY_r", true);
                Assert.AreEqual(gotVal, test.int_property_r);
            }
        }