public void Access_Invalid () { SmtpPermissionAttribute a = new SmtpPermissionAttribute (SecurityAction.Assert); a.Access = "invalid"; Assert.AreEqual ("invalid", a.Access, "invalid"); // no validation in attribute }
public void Default () { SmtpPermissionAttribute a = new SmtpPermissionAttribute (SecurityAction.Assert); Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId"); Assert.IsFalse (a.Unrestricted, "Unrestricted"); Assert.IsNull (a.Access, "Access"); SmtpPermission perm = (SmtpPermission) a.CreatePermission (); Assert.IsFalse (a.Unrestricted, "Unrestricted"); }
public void Access () { SmtpPermissionAttribute a = new SmtpPermissionAttribute (SecurityAction.Assert); Assert.IsNull (a.Access, "Null-default"); Access (a, String.Empty); Access (a, "None"); Access (a, "none"); Access (a, "NONE"); Access (a, "nOnE"); Access (a, "Connect"); Access (a, "connect"); Access (a, "CONNECT"); Access (a, "cOnNeCt"); a.Access = null; Assert.IsNull (a.Access, "Null"); }
public void Action () { SmtpPermissionAttribute a = new SmtpPermissionAttribute (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"); }
private void Access (SmtpPermissionAttribute a, string s) { a.Access = s; Assert.AreEqual (s, a.Access, s); }
public void Unrestricted () { SmtpPermissionAttribute a = new SmtpPermissionAttribute (SecurityAction.Assert); a.Unrestricted = true; SmtpPermission dp = (SmtpPermission) a.CreatePermission (); Assert.IsTrue (dp.IsUnrestricted (), "IsUnrestricted"); a.Unrestricted = false; dp = (SmtpPermission) a.CreatePermission (); Assert.IsFalse (dp.IsUnrestricted (), "!IsUnrestricted"); }
public void CreatePermission_Invalid () { SmtpPermissionAttribute a = new SmtpPermissionAttribute (SecurityAction.Assert); a.Access = String.Empty; Assert.AreEqual (0, a.Access.Length, "Empty"); Assert.IsNotNull (a.CreatePermission (), "Empty-Permission"); }
public void Action_Invalid () { SmtpPermissionAttribute a = new SmtpPermissionAttribute ((SecurityAction) Int32.MinValue); // no validation in attribute }