예제 #1
0
        public void DisableSenderTrustCheck()
        {
            LocalMessageReceiver lmr = new LocalMessageReceiver("x");

            Assert.IsFalse(lmr.DisableSenderTrustCheck, "DisableSenderTrustCheck/Default");

            lmr.DisableSenderTrustCheck = true;
            Assert.IsTrue(lmr.DisableSenderTrustCheck, "DisableSenderTrustCheck/Change");

            lmr.Listen();
            Assert.Throws <InvalidOperationException> (delegate {
                // throw, even if setting the actual value
                lmr.DisableSenderTrustCheck = true;
            }, "Listen/InvalidOperationException");

            lmr.Dispose();
            Assert.Throws <ObjectDisposedException> (delegate {
                // throw, even if setting the actual value
                lmr.DisableSenderTrustCheck = true;
            }, "Dispose/ObjectDisposedException");

            // other properties are still available after dispose
            Assert.IsNull(lmr.AllowedSenderDomains, "AllowedSenderDomains");
            Assert.AreEqual(ReceiverNameScope.Domain, lmr.NameScope, "NameScope");
            Assert.AreEqual("x", lmr.ReceiverName, "ReceiverName");
        }
 public void Dispose()
 {
     _receiver.Dispose();
 }