public void Default() { RegistryPermissionAttribute a = new RegistryPermissionAttribute(SecurityAction.Assert); Assert.IsNull(a.Create, "Create"); Assert.IsNull(a.Read, "Read"); Assert.IsNull(a.Write, "Write"); #if NET_2_0 Assert.IsNull(a.ChangeAccessControl, "ChangeAccessControl"); Assert.IsNull(a.ViewAccessControl, "ViewAccessControl"); #endif Assert.AreEqual(a.ToString(), a.TypeId.ToString(), "TypeId"); Assert.IsFalse(a.Unrestricted, "Unrestricted"); RegistryPermission perm = (RegistryPermission)a.CreatePermission(); #if NET_2_0 Assert.AreEqual(String.Empty, perm.GetPathList(RegistryPermissionAccess.Create), "Create"); Assert.AreEqual(String.Empty, perm.GetPathList(RegistryPermissionAccess.Read), "Read"); Assert.AreEqual(String.Empty, perm.GetPathList(RegistryPermissionAccess.Write), "Write"); #else Assert.IsNull(perm.GetPathList(RegistryPermissionAccess.Create), "Create"); Assert.IsNull(perm.GetPathList(RegistryPermissionAccess.Read), "Read"); Assert.IsNull(perm.GetPathList(RegistryPermissionAccess.Write), "Write"); #endif }
public void Unrestricted() { RegistryPermissionAttribute a = new RegistryPermissionAttribute(SecurityAction.Assert); a.Unrestricted = true; RegistryPermission perm = (RegistryPermission)a.CreatePermission(); Assert.IsTrue(perm.IsUnrestricted(), "CreatePermission.IsUnrestricted"); }
public static void RegistryPermissionAttributeCallMethods() { RegistryPermissionAttribute rpa = new RegistryPermissionAttribute(new Permissions.SecurityAction()); IPermission ip = rpa.CreatePermission(); }