FromXml() public method

public FromXml ( SecurityElement elem ) : void
elem SecurityElement
return void
コード例 #1
0
		public void FromXmlWrongVersion ()
		{
			RegistryPermission ep = new RegistryPermission (PermissionState.None);
			SecurityElement se = ep.ToXml ();
			// can't modify - so we create our own
			SecurityElement se2 = new SecurityElement (se.Tag, se.Text);
			se2.AddAttribute ("class", se.Attribute ("class"));
			se2.AddAttribute ("version", "2");
			ep.FromXml (se2);
		}
コード例 #2
0
		public void FromXml ()
		{
			RegistryPermission ep = new RegistryPermission (PermissionState.None);
			SecurityElement se = ep.ToXml ();
			Assert.IsNotNull (se, "ToXml()");
			ep.FromXml (se);
			se.AddAttribute ("Read", keyLocalMachine);
			ep.FromXml (se);
			Assert.AreEqual (keyLocalMachine, ep.GetPathList (RegistryPermissionAccess.Read), "FromXml-Read");
			se.AddAttribute ("Write", keyLocalMachine);
			ep.FromXml (se);
			Assert.AreEqual (keyLocalMachine, ep.GetPathList (RegistryPermissionAccess.Read), "FromXml-Read");
			Assert.AreEqual (keyLocalMachine, ep.GetPathList (RegistryPermissionAccess.Write), "FromXml-Write");
			se.AddAttribute ("Create", keyCurrentUser);
			ep.FromXml (se);
			Assert.AreEqual (keyLocalMachine, ep.GetPathList (RegistryPermissionAccess.Read), "FromXml-Read");
			Assert.AreEqual (keyLocalMachine, ep.GetPathList (RegistryPermissionAccess.Write), "FromXml-Write");
			Assert.AreEqual (keyCurrentUser, ep.GetPathList (RegistryPermissionAccess.Create), "FromXml-Create");
		}
コード例 #3
0
		public void FromXmlNull ()
		{
			RegistryPermission ep = new RegistryPermission (PermissionState.None);
			ep.FromXml (null);
		}