public void ConstructorState_Deny_Unrestricted () { AspNetHostingPermission p = new AspNetHostingPermission (PermissionState.None); Assert.AreEqual (AspNetHostingPermissionLevel.None, p.Level, "Level"); Assert.IsFalse (p.IsUnrestricted (), "IsUnrestricted"); CommonTests (p); }
public void ConstructorLevel_Deny_Unrestricted () { AspNetHostingPermission p = new AspNetHostingPermission (AspNetHostingPermissionLevel.Unrestricted); Assert.AreEqual (AspNetHostingPermissionLevel.Unrestricted, p.Level, "Level"); Assert.IsTrue (p.IsUnrestricted (), "IsUnrestricted"); CommonTests (p); }
public void PermissionState_None () { PermissionState ps = PermissionState.None; AspNetHostingPermission anhp = new AspNetHostingPermission (ps); Assert.AreEqual (AspNetHostingPermissionLevel.None, anhp.Level, "Level"); Assert.IsFalse (anhp.IsUnrestricted (), "IsUnrestricted"); SecurityElement se = anhp.ToXml (); // only class and version are present Assert.AreEqual ("None", se.Attribute ("Level"), "Xml-Level"); Assert.IsNull (se.Children, "Xml-Children"); AspNetHostingPermission copy = (AspNetHostingPermission)anhp.Copy (); Assert.IsFalse (Object.ReferenceEquals (anhp, copy), "ReferenceEquals"); Assert.AreEqual (anhp.Level, copy.Level, "Level"); Assert.AreEqual (anhp.IsUnrestricted (), copy.IsUnrestricted (), "IsUnrestricted ()"); }
public void PermissionState_Unrestricted () { PermissionState ps = PermissionState.Unrestricted; AspNetHostingPermission anhp = new AspNetHostingPermission (ps); Assert.AreEqual (AspNetHostingPermissionLevel.Unrestricted, anhp.Level, "Level"); Assert.IsTrue (anhp.IsUnrestricted (), "IsUnrestricted"); SecurityElement se = anhp.ToXml (); // fixed in 2.0 RC Assert.IsNotNull (se.Attribute ("Unrestricted"), "Xml-Unrestricted"); Assert.AreEqual ("Unrestricted", se.Attribute ("Level"), "Xml-Level"); Assert.IsNull (se.Children, "Xml-Children"); AspNetHostingPermission copy = (AspNetHostingPermission)anhp.Copy (); Assert.IsFalse (Object.ReferenceEquals (anhp, copy), "ReferenceEquals"); Assert.AreEqual (anhp.Level, copy.Level, "Level"); Assert.AreEqual (anhp.IsUnrestricted (), copy.IsUnrestricted (), "IsUnrestricted ()"); }