public void PermissionState_Unrestricted () { PermissionState ps = PermissionState.Unrestricted; DnsPermission dp = new DnsPermission (ps); Assert.IsTrue (dp.IsUnrestricted (), "IsUnrestricted"); SecurityElement se = dp.ToXml (); Assert.AreEqual ("true", se.Attribute ("Unrestricted"), "Xml-Unrestricted"); Assert.AreEqual (3, se.Attributes.Count, "Xml-Attributes#"); Assert.IsNull (se.Children, "Xml-Children"); DnsPermission copy = (DnsPermission)dp.Copy (); Assert.IsFalse (Object.ReferenceEquals (dp, copy), "ReferenceEquals"); Assert.AreEqual (dp.IsUnrestricted (), copy.IsUnrestricted (), "IsUnrestricted ()"); }
public void PermissionState_None () { PermissionState ps = PermissionState.None; DnsPermission dp = new DnsPermission (ps); Assert.IsFalse (dp.IsUnrestricted (), "IsUnrestricted"); SecurityElement se = dp.ToXml (); // only class and version are present Assert.AreEqual (2, se.Attributes.Count, "Xml-Attributes#"); Assert.IsNull (se.Children, "Xml-Children"); DnsPermission copy = (DnsPermission)dp.Copy (); Assert.IsFalse (Object.ReferenceEquals (dp, copy), "ReferenceEquals"); Assert.AreEqual (dp.IsUnrestricted (), copy.IsUnrestricted (), "IsUnrestricted ()"); }