public void Default () { PerformanceCounterPermissionAttribute a = new PerformanceCounterPermissionAttribute (SecurityAction.Assert); Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId"); Assert.IsFalse (a.Unrestricted, "Unrestricted"); Assert.AreEqual (".", a.MachineName, "MachineName"); Assert.AreEqual ("*", a.CategoryName, "CategoryName"); Assert.AreEqual (PerformanceCounterPermissionAccess.Write, a.PermissionAccess, "PermissionAccess"); PerformanceCounterPermission sp = (PerformanceCounterPermission)a.CreatePermission (); Assert.IsFalse (sp.IsUnrestricted (), "IsUnrestricted"); }
public void Unrestricted () { PerformanceCounterPermissionAttribute a = new PerformanceCounterPermissionAttribute (SecurityAction.Assert); a.Unrestricted = true; PerformanceCounterPermission wp = (PerformanceCounterPermission)a.CreatePermission (); Assert.IsTrue (wp.IsUnrestricted (), "IsUnrestricted"); a.Unrestricted = false; wp = (PerformanceCounterPermission)a.CreatePermission (); Assert.IsFalse (wp.IsUnrestricted (), "!IsUnrestricted"); }