public void FromXml_NoVersion () { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); SecurityElement se = pcp.ToXml (); SecurityElement w = new SecurityElement (se.Tag); w.AddAttribute ("class", se.Attribute ("class")); pcp.FromXml (w); }
public void FromXml_WrongVersion () { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); SecurityElement se = pcp.ToXml (); se.Attributes.Remove ("version"); se.Attributes.Add ("version", "2"); pcp.FromXml (se); }
public void FromXml_NoClass () { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); SecurityElement se = pcp.ToXml (); SecurityElement w = new SecurityElement (se.Tag); w.AddAttribute ("version", se.Attribute ("version")); pcp.FromXml (w); // doesn't even care of the class attribute presence }
public void FromXml_WrongClass () { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); SecurityElement se = pcp.ToXml (); SecurityElement w = new SecurityElement (se.Tag); w.AddAttribute ("class", "Wrong" + se.Attribute ("class")); w.AddAttribute ("version", se.Attribute ("version")); pcp.FromXml (w); // doesn't care of the class name at that stage // anyway the class has already be created so... }
public void FromXml_WrongTagCase () { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); SecurityElement se = pcp.ToXml (); se.Tag = "IPERMISSION"; // instead of IPermission pcp.FromXml (se); // note: normally IPermission classes (in corlib) DO care about the // IPermission tag }
public void FromXml_Null () { PerformanceCounterPermission pcp = new PerformanceCounterPermission (PermissionState.None); pcp.FromXml (null); }