public void Action () { SocketPermissionAttribute a = new SocketPermissionAttribute (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 () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId"); Assert.IsFalse (a.Unrestricted, "Unrestricted"); Assert.IsNull (a.Access, "Access"); Assert.IsNull (a.Host, "Host"); Assert.IsNull (a.Port, "Port"); Assert.IsNull (a.Transport, "Transport"); a.Access = "connect"; a.Host = String.Empty; a.Port = "80"; a.Transport = "tcp"; SocketPermission sp = (SocketPermission) a.CreatePermission (); Assert.IsFalse (sp.IsUnrestricted (), "IsUnrestricted"); }
public void Unrestricted () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Access = "connect"; a.Host = String.Empty; a.Port = "80"; a.Transport = "tcp"; a.Unrestricted = true; SocketPermission wp = (SocketPermission)a.CreatePermission (); Assert.IsTrue (wp.IsUnrestricted (), "IsUnrestricted"); a.Unrestricted = false; wp = (SocketPermission)a.CreatePermission (); Assert.IsFalse (wp.IsUnrestricted (), "!IsUnrestricted"); }
public void Action_Invalid () { SocketPermissionAttribute a = new SocketPermissionAttribute ((SecurityAction)Int32.MinValue); // no validation in attribute }
public void Transport () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Transport = "http"; }
public void Transport_Dual_Null () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Transport = "/"; a.Transport = null; }
public void Transport_Null () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Transport = null; // legal Assert.IsNull (a.Transport, "Transport"); }
public void Transport_Null_CreatePermission () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Access = String.Empty; a.Host = String.Empty; a.Port = String.Empty; a.Transport = null; // legal (assign) SocketPermission sp = (SocketPermission)a.CreatePermission (); }
public void Port () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Port = "80"; }
public void Port_Dual () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Port = "/"; a.Port = "\\"; }
public void Host () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Host = "www.mono-project.com"; }
public void Host_Null () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Host = null; // legal Assert.IsNull (a.Host, "Host"); }
public void Access () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Access = "/"; }
public void Access_Dual_Null () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Access = "/"; a.Access = null; }
public void Access_Null () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Access = null; // legal Assert.IsNull (a.Access, "Access"); }
public void Access_Null_CreatePermission () { SocketPermissionAttribute a = new SocketPermissionAttribute (SecurityAction.Assert); a.Access = null; // legal (assign) SocketPermission sp = (SocketPermission) a.CreatePermission (); }