Ejemplo n.º 1
0
        public void TestFieldProtected()
        {
            //direct
            FieldInfo f = IntrospectionUtil.FindField(typeof(ClassFixtureA), "protectedA", typeof(int), true, false);

            Assert.AreEqual(f, protectedAField);

            //inheritance
            f = IntrospectionUtil.FindField(typeof(ClassFixtureB), "protectedA", typeof(int), true, false);
            Assert.AreEqual(f, protectedAField);
        }
Ejemplo n.º 2
0
        public void TestFieldDefault()
        {
            //direct
            FieldInfo f = IntrospectionUtil.FindField(typeof(ClassFixtureA), "internalA", typeof(int), true, false);

            Assert.AreEqual(f, defaultAField);

            //inheritance
            f = IntrospectionUtil.FindField(typeof(ClassFixtureB), "internalA", typeof(int), true, false);
            Assert.AreEqual(f, defaultAField);
        }
Ejemplo n.º 3
0
        public void TestFieldPrivate()
        {
            //direct
            FieldInfo f = IntrospectionUtil.FindField(typeof(ClassFixtureA), "privateA", typeof(int), true, false);

            Assert.AreEqual(privateAField, f);

            try
            {
                //inheritance
                IntrospectionUtil.FindField(typeof(ClassFixtureB), "privateB", typeof(int), true, false);
                Assert.Fail("Private fields should not be inherited");
            }
            catch (ArgumentException)
            {
            }
        }