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); }
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); }
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) { } }