public void Action ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute (SecurityAction.Assert);
			Assert.AreEqual (SecurityAction.Assert, a.Action, "Action=Assert");
			a.Action = SecurityAction.Demand;
			Assert.AreEqual (SecurityAction.Demand, a.Action, "Action=Demand");
			a.Action = SecurityAction.Deny;
			Assert.AreEqual (SecurityAction.Deny, a.Action, "Action=Deny");
			a.Action = SecurityAction.InheritanceDemand;
			Assert.AreEqual (SecurityAction.InheritanceDemand, a.Action, "Action=InheritanceDemand");
			a.Action = SecurityAction.LinkDemand;
			Assert.AreEqual (SecurityAction.LinkDemand, a.Action, "Action=LinkDemand");
			a.Action = SecurityAction.PermitOnly;
			Assert.AreEqual (SecurityAction.PermitOnly, a.Action, "Action=PermitOnly");
			a.Action = SecurityAction.RequestMinimum;
			Assert.AreEqual (SecurityAction.RequestMinimum, a.Action, "Action=RequestMinimum");
			a.Action = SecurityAction.RequestOptional;
			Assert.AreEqual (SecurityAction.RequestOptional, a.Action, "Action=RequestOptional");
			a.Action = SecurityAction.RequestRefuse;
			Assert.AreEqual (SecurityAction.RequestRefuse, a.Action, "Action=RequestRefuse");
#if NET_2_0
			a.Action = SecurityAction.DemandChoice;
			Assert.AreEqual (SecurityAction.DemandChoice, a.Action, "Action=DemandChoice");
			a.Action = SecurityAction.InheritanceDemandChoice;
			Assert.AreEqual (SecurityAction.InheritanceDemandChoice, a.Action, "Action=InheritanceDemandChoice");
			a.Action = SecurityAction.LinkDemandChoice;
			Assert.AreEqual (SecurityAction.LinkDemandChoice, a.Action, "Action=LinkDemandChoice");
#endif
		}
		public void Default ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute (SecurityAction.Assert);
			Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId");
			Assert.IsFalse (a.Unrestricted, "Unrestricted");
			Assert.AreEqual (".", a.MachineName, "MachineName");
			Assert.AreEqual (ServiceControllerPermissionAccess.Browse, a.PermissionAccess, "PermissionAccess");

			ServiceControllerPermission sp = (ServiceControllerPermission)a.CreatePermission ();
			Assert.IsFalse (sp.IsUnrestricted (), "IsUnrestricted");
		}
		public void MachineName_Null ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute (SecurityAction.Assert);
			a.MachineName = null;
		}
		public void Unrestricted ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute (SecurityAction.Assert);
			a.Unrestricted = true;
			ServiceControllerPermission wp = (ServiceControllerPermission)a.CreatePermission ();
			Assert.IsTrue (wp.IsUnrestricted (), "IsUnrestricted");

			a.Unrestricted = false;
			wp = (ServiceControllerPermission)a.CreatePermission ();
			Assert.IsFalse (wp.IsUnrestricted (), "!IsUnrestricted");
		}
		public void PermissionAccess_Invalid ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute (SecurityAction.Assert);
			a.PermissionAccess = (ServiceControllerPermissionAccess)Int32.MinValue;
			Assert.AreEqual ((ServiceControllerPermissionAccess)Int32.MinValue, a.PermissionAccess, "None");
			// no exception thrown
		}
		public void PermissionAccess ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute (SecurityAction.Assert);
			a.PermissionAccess = ServiceControllerPermissionAccess.None;
			Assert.AreEqual (ServiceControllerPermissionAccess.None, a.PermissionAccess, "None");
			a.PermissionAccess = ServiceControllerPermissionAccess.Browse;
			Assert.AreEqual (ServiceControllerPermissionAccess.Browse, a.PermissionAccess, "Browse");
			a.PermissionAccess = ServiceControllerPermissionAccess.Control;
			Assert.AreEqual (ServiceControllerPermissionAccess.Control, a.PermissionAccess, "Control");
		}
		public void ServiceName ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute (SecurityAction.Assert);
			for (int i = 0; i < 256; i++) {
				try {
					a.ServiceName = Convert.ToChar (i).ToString ();
					Assert.AreEqual (i, (int)a.ServiceName [0], i.ToString ());
				}
				catch {
					switch (i) {
						case 47:
						case 92:
							// known invalid chars
							break;
						default:
							Assert.Fail (i.ToString ());
							break;
					}
				}
			}
			// all first 256 characters seems to be valid
			// is there other rules ?
		}
		public void ServiceName_Empty ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute (SecurityAction.Assert);
			a.ServiceName = String.Empty;
		}
		public void Action_Invalid ()
		{
			ServiceControllerPermissionAttribute a = new ServiceControllerPermissionAttribute ((SecurityAction)Int32.MinValue);
			// no validation in attribute
		}