public void TestGetPropertyVisibility() { PropertyInfo fld = typeof(TestClass).GetProperty("AProperty"); string vis = ReflectionEngineUtility.GetPropertyVisibility(fld); Assert.AreEqual(vis, "public", "Wrong value for visibility."); fld = typeof(TestClass).GetProperty("AProperty1", BindingFlags.Instance | BindingFlags.NonPublic); vis = ReflectionEngineUtility.GetPropertyVisibility(fld); Assert.AreEqual(vis, "protected", "Wrong value for visibility."); fld = typeof(TestClass).GetProperty("AProperty2", BindingFlags.Instance | BindingFlags.NonPublic); vis = ReflectionEngineUtility.GetPropertyVisibility(fld); Assert.AreEqual(vis, "private", "Wrong value for visibility."); fld = typeof(TestClass).GetProperty("AProperty3", BindingFlags.Instance | BindingFlags.NonPublic); vis = ReflectionEngineUtility.GetPropertyVisibility(fld); Assert.AreEqual(vis, "internal", "Wrong value for visibility."); fld = typeof(TestClass).GetProperty("AProperty4", BindingFlags.Instance | BindingFlags.NonPublic); vis = ReflectionEngineUtility.GetPropertyVisibility(fld); Assert.AreEqual(vis, "protected internal", "Wrong value for visibility."); }
public void TestGetPropertyVisibilityFail1() { ReflectionEngineUtility.GetPropertyVisibility(null); }