public void FromXML () { p = new FileIOPermission(PermissionState.None); SecurityElement esd = new SecurityElement("IPermission"); esd.AddAttribute("class", "FileIOPermission"); esd.AddAttribute("version", "1"); esd.AddAttribute("Unrestricted", "true"); p.FromXml(esd); Assert.IsTrue(p.IsUnrestricted(), "Should get an unrestricted permission"); esd = new SecurityElement("IPermission"); esd.AddAttribute("class", "FileIOPermission"); esd.AddAttribute("version", "1"); // FIXME: Adjust to run on Mac OS's if (Path.VolumeSeparatorChar == ':') { esd.AddAttribute("Read", "c:\\temp;d:\\temp2"); esd.AddAttribute("Write", "c:\\temp;d:\\temp2;z:\\temp3"); } else { esd.AddAttribute("Read", "/temp;/usr/temp2"); esd.AddAttribute("Write", "/temp;/usr/temp2;/usr/bin/temp3"); } p = new FileIOPermission(PermissionState.None); p.FromXml(esd); pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read); Assert.IsTrue(pathsInPermission.Length == 2, "Path list should have 2 for Read"); pathsInPermission = p.GetPathList(FileIOPermissionAccess.Write); Assert.IsTrue(pathsInPermission.Length == 3, "Path list should have 2 for Write"); }