public void Constructor_MessageInner () { SecurityException se = new SecurityException ("message", new Exception ()); #if ! NET_1_0 Assert.IsNull (se.GrantedSet, "GrantedSet"); Assert.IsNull (se.RefusedSet, "RefusedSet"); #endif Assert.IsNull (se.PermissionState, "PermissionState"); Assert.IsNull (se.PermissionType, "PermissionType"); Assert.IsTrue (se.ToString ().StartsWith ("System.Security.SecurityException: message"), "ToString().Starts"); Assert.IsTrue ((se.ToString ().IndexOf ("System.Exception") > 0), "ToString().Include"); }
public void Constructor_Empty () { SecurityException se = new SecurityException (); #if ! NET_1_0 Assert.IsNull (se.GrantedSet, "GrantedSet"); Assert.IsNull (se.RefusedSet, "RefusedSet"); #endif Assert.IsNull (se.PermissionState, "PermissionState"); Assert.IsNull (se.PermissionType, "PermissionType"); Assert.IsTrue (se.ToString ().StartsWith ("System.Security.SecurityException: "), "ToString()"); }
public void Constructor_Message () { SecurityException se = new SecurityException ("message"); #if ! NET_1_0 Assert.IsNull (se.GrantedSet, "GrantedSet"); Assert.IsNull (se.RefusedSet, "RefusedSet"); #endif Assert.IsNull (se.PermissionState, "PermissionState"); Assert.IsNull (se.PermissionType, "PermissionType"); Assert.AreEqual ("System.Security.SecurityException: message", se.ToString (), "ToString()"); }
public void Constructor_Message () { SecurityException se = new SecurityException ("message"); #if ! NET_1_0 AssertNull ("GrantedSet", se.GrantedSet); AssertNull ("RefusedSet", se.RefusedSet); #endif AssertNull ("PermissionState", se.PermissionState); AssertNull ("PermissionType", se.PermissionType); AssertEquals ("ToString()", "System.Security.SecurityException: message", se.ToString ()); }
public void Constructor_Empty () { SecurityException se = new SecurityException (); #if ! NET_1_0 AssertNull ("GrantedSet", se.GrantedSet); AssertNull ("RefusedSet", se.RefusedSet); #endif AssertNull ("PermissionState", se.PermissionState); AssertNull ("PermissionType", se.PermissionType); Assert ("ToString()", se.ToString ().StartsWith ("System.Security.SecurityException: ")); }
public void Constructor_MessageTypeState () { SecurityException se = new SecurityException ("message", typeof (EnvironmentPermission), "mono"); #if ! NET_1_0 Assert.IsNull (se.GrantedSet, "GrantedSet"); Assert.IsNull (se.RefusedSet, "RefusedSet"); #endif Assert.AreEqual ("mono", se.PermissionState, "PermissionState"); Assert.AreEqual (typeof (EnvironmentPermission), se.PermissionType, "PermissionType"); Assert.IsTrue ((se.ToString ().IndexOf ("mono") > 0), "ToString().Include(mono)"); // note: can't check for PermissionType as it's not shown with MS class lib }
public void Constructor_MessageType () { SecurityException se = new SecurityException ("message", typeof (EnvironmentPermission)); #if ! NET_1_0 Assert.IsNull (se.GrantedSet, "GrantedSet"); Assert.IsNull (se.RefusedSet, "RefusedSet"); #endif Assert.IsNull (se.PermissionState, "PermissionState"); Assert.AreEqual (typeof (EnvironmentPermission), se.PermissionType, "PermissionType"); Assert.IsTrue (se.ToString ().StartsWith ("System.Security.SecurityException: message"), "ToString().Starts"); // note: can't check for PermissionType as it's not shown with MS class lib }
private static void HandleInnerException(ref RunningResults results, SecurityException ex) { results.Verdict = Verdict.SecurityException; results.Error = ex.ToString(); }
public void ToString_WithSuppliedSensitiveInformation2 () { // here we supply something *sensitive* as the state string sensitive = "*SENSITIVE*"; SecurityException se = new SecurityException ("message", typeof (Object), sensitive); // and we EXPECT it to be shown in the output // as we pass the security checks for PermissionState property Assert.IsFalse (se.ToString ().IndexOf (sensitive) == -1, sensitive); }
public void ToString_WithSuppliedSensitiveInformation1 () { // here we supply something *sensitive* as the state string sensitive = "*SENSITIVE*"; SecurityException se = new SecurityException ("message", typeof (Object), sensitive); // and we don't expect it to be shown in the output Assert.IsTrue (se.ToString ().IndexOf (sensitive) == -1, sensitive); }