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); }
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"); }
public void FromXmlNull () { RegistryPermission ep = new RegistryPermission (PermissionState.None); ep.FromXml (null); }