Copy() public method

public Copy ( ) : IPermission
return IPermission
		private void CommonTests (AspNetHostingPermission p)
		{
			Assert.IsNotNull (p.Copy (), "Copy");
			SecurityElement se = p.ToXml ();
			Assert.IsNotNull (se, "ToXml");
			p.FromXml (se);
			Assert.IsNotNull (p.Intersect (p), "Intersect");
			Assert.IsTrue (p.IsSubsetOf (p), "IsSubsetOf");
			Assert.IsNotNull (p.Union (p), "Union");
		}
		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 ()");
		}
		public void Copy ()
		{
			AspNetHostingPermission anhp = new AspNetHostingPermission (PermissionState.None);
			foreach (AspNetHostingPermissionLevel ppl in AllLevel) {
				anhp.Level = ppl;
				AspNetHostingPermission copy = (AspNetHostingPermission)anhp.Copy ();
				Assert.AreEqual (ppl, copy.Level, ppl.ToString ());
			}
		}