Пример #1
0
        private void Close()
        {
            if (_transaction != null)
            {
                _transaction.Close();
            }

            if (_writer != null)
            {
                _writer.Close();
            }
            if (_reader != null)
            {
                _reader.Close();
            }
            if (_stream != null)
            {
                _stream.Close();
            }
            if (_client != null)
            {
                _client.Close();
            }

            EndSession();
        }
Пример #2
0
        public override SMTPResponse DoExecute(SMTPTransaction transaction, string parameters)
        {
            if (!string.IsNullOrWhiteSpace(parameters))
            {
                return(new SMTPResponse(SMTPStatusCode.SyntaxError));
            }


            transaction.Close();

            return(new SMTPResponse(SMTPStatusCode.Closing));
        }
Пример #3
0
        public void TestClose()
        {
            using (ShimsContext.Create())
            {
                var server      = new ShimSMTPServer();
                var settings    = new StubIReceiveSettings();
                var transaction = new SMTPTransaction(server, settings);

                var closed = false;

                transaction.OnClose += smtpTransaction => closed = true;

                Assert.False(transaction.Closed);

                transaction.Close();

                Assert.True(transaction.Closed);
                Assert.True(closed);
            }
        }