Copy() public method

public Copy ( ) : IPermission
return IPermission
		public void PermissionStateUnrestricted () 
		{
			FileDialogPermission p = new FileDialogPermission (PermissionState.Unrestricted);
			Assert.IsNotNull (p, "FileDialogPermission(PermissionState.Unrestricted)");
			Assert.IsTrue (p.IsUnrestricted (), "IsUnrestricted");
			FileDialogPermission copy = (FileDialogPermission) p.Copy ();
			Assert.AreEqual (p.IsUnrestricted (), copy.IsUnrestricted (), "Copy.IsUnrestricted");
			SecurityElement se = p.ToXml ();
			Assert.AreEqual ("true", (se.Attributes ["Unrestricted"] as string), "ToXml-Unrestricted");
		}
		public void PermissionStateUnrestricted () 
		{
			FileDialogPermission p = new FileDialogPermission (PermissionState.Unrestricted);
			AssertNotNull ("FileDialogPermission(PermissionState.Unrestricted)", p);
			Assert ("IsUnrestricted", p.IsUnrestricted ());
			FileDialogPermission copy = (FileDialogPermission) p.Copy ();
			AssertEquals ("Copy.IsUnrestricted", p.IsUnrestricted (), copy.IsUnrestricted ());
			SecurityElement se = p.ToXml ();
			AssertEquals ("ToXml-Unrestricted", "true", (se.Attributes ["Unrestricted"] as string));
		}
		public void PermissionStateNone () 
		{
			FileDialogPermission p = new FileDialogPermission (PermissionState.None);
			Assert.IsNotNull (p, "FileDialogPermission(PermissionState.None)");
			Assert.IsTrue (!p.IsUnrestricted (), "IsUnrestricted");
			FileDialogPermission copy = (FileDialogPermission) p.Copy ();
			Assert.AreEqual (p.IsUnrestricted (), copy.IsUnrestricted (), "Copy.IsUnrestricted");
			SecurityElement se = p.ToXml ();
			Assert.IsTrue ((se.Attributes ["class"] as string).StartsWith (className), "ToXml-class");
			Assert.AreEqual ("1", (se.Attributes ["version"] as string), "ToXml-version");
		}
		public void PermissionStateNone () 
		{
			FileDialogPermission p = new FileDialogPermission (PermissionState.None);
			AssertNotNull ("FileDialogPermission(PermissionState.None)", p);
			Assert ("IsUnrestricted", !p.IsUnrestricted ());
			FileDialogPermission copy = (FileDialogPermission) p.Copy ();
			AssertEquals ("Copy.IsUnrestricted", p.IsUnrestricted (), copy.IsUnrestricted ());
			SecurityElement se = p.ToXml ();
			Assert ("ToXml-class", (se.Attributes ["class"] as string).StartsWith (className));
			AssertEquals ("ToXml-version", "1", (se.Attributes ["version"] as string));
		}
		public void FromXml () 
		{
			FileDialogPermission p = new FileDialogPermission (PermissionState.None);
			SecurityElement se = p.ToXml ();
			Assert.IsNotNull (se, "ToXml()");

			FileDialogPermission p2 = (FileDialogPermission) p.Copy ();
			p2.FromXml (se);
			Assert.AreEqual (FileDialogPermissionAccess.None, p2.Access, "FromXml-None");

			se.AddAttribute ("Access", "Open");
			p2.FromXml (se);
			Assert.AreEqual (FileDialogPermissionAccess.Open, p2.Access, "FromXml-Open");

			se = p.ToXml ();
			se.AddAttribute ("Access", "Save");
			p2.FromXml (se);
			Assert.AreEqual (FileDialogPermissionAccess.Save, p2.Access, "FromXml-Save");

			se = p.ToXml ();
			se.AddAttribute ("Unrestricted", "true");
			p2.FromXml (se);
			Assert.IsTrue (p2.IsUnrestricted (), "FromXml-Unrestricted");
		}