public void AddPermission() { SmtpPermission sp = new SmtpPermission(false); Assert.AreEqual(SmtpAccess.None, sp.Access, "Access-default"); sp.AddPermission(SmtpAccess.Connect); Assert.AreEqual(SmtpAccess.Connect, sp.Access, "Connect"); sp.AddPermission(SmtpAccess.ConnectToUnrestrictedPort); Assert.AreEqual(SmtpAccess.ConnectToUnrestrictedPort, sp.Access, "ConnectToUnrestrictedPort"); }
public void AddPermission_Invalid() { SmtpAccess sa = (SmtpAccess)Int32.MinValue; SmtpPermission sp = new SmtpPermission(false); sp.AddPermission(sa); Assert.AreEqual(SmtpAccess.None, sp.Access, "None"); }
// </snippet4> // <snippet5> public static SmtpPermission GiveFullAccess(SmtpPermission permission) { permission.AddPermission(SmtpAccess.Connect); return(permission); }