Example #1
0
        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");
        }
Example #2
0
        public void AddPermission_Invalid()
        {
            SmtpAccess     sa = (SmtpAccess)Int32.MinValue;
            SmtpPermission sp = new SmtpPermission(false);

            sp.AddPermission(sa);
            Assert.AreEqual(SmtpAccess.None, sp.Access, "None");
        }
Example #3
0
// </snippet4>
// <snippet5>
        public static SmtpPermission GiveFullAccess(SmtpPermission permission)
        {
            permission.AddPermission(SmtpAccess.Connect);
            return(permission);
        }