当前位置: 首页>>代码示例>>C#>>正文


C# Mocks.VerifyWriteResponse方法代码示例

本文整理汇总了C#中Mocks.VerifyWriteResponse方法的典型用法代码示例。如果您正苦于以下问题:C# Mocks.VerifyWriteResponse方法的具体用法?C# Mocks.VerifyWriteResponse怎么用?C# Mocks.VerifyWriteResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mocks的用法示例。


在下文中一共展示了Mocks.VerifyWriteResponse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Noop

        public void Noop()
        {
            Mocks mocks = new Mocks();

            NoopVerb verb = new NoopVerb();
            verb.Process(mocks.Connection.Object, new SmtpCommand("NOOP"));

            mocks.VerifyWriteResponse(StandardSmtpResponseCode.OK);
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:9,代码来源:NoopVerbTests.cs

示例2: MessageAboveFixedSize

        public void MessageAboveFixedSize()
        {
            Mocks mocks = new Mocks();

            Message message = new Message(mocks.Session.Object);
            mocks.Connection.SetupGet(c => c.CurrentMessage).Returns(message);
            mocks.ServerBehaviour.Setup(b => b.GetMaximumMessageSize(It.IsAny<IConnection>())).Returns(10);

            string[] messageData = new string[] { new string('x', 11), "." };
            int messageLine = 0;
            mocks.Connection.Setup(c => c.ReadLine()).Returns(() => messageData[messageLine++]);

            DataVerb verb = new DataVerb();
            verb.Process(mocks.Connection.Object, new SmtpCommand("DATA"));

            mocks.VerifyWriteResponse(StandardSmtpResponseCode.StartMailInputEndWithDot);
            mocks.VerifyWriteResponse(StandardSmtpResponseCode.ExceededStorageAllocation);
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:18,代码来源:DataVerbTests.cs

示例3: SayHelo

        public void SayHelo()
        {
            Mocks mocks = new Mocks();

            HeloVerb verb = new HeloVerb();
            verb.Process(mocks.Connection.Object, new SmtpCommand("HELO foo.blah"));

            mocks.VerifyWriteResponse(StandardSmtpResponseCode.OK);
            mocks.Session.VerifySet(s => s.ClientName, "foo.bar");
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:10,代码来源:HeloVerbTests.cs

示例4: SayHeloTwice_ReturnsError

        public void SayHeloTwice_ReturnsError()
        {
            Mocks mocks = new Mocks();
            mocks.Session.SetupGet(s => s.ClientName).Returns("already.said.helo");
            mocks.Session.SetupSet(s => s.ClientName).Never();

            HeloVerb verb = new HeloVerb();
            verb.Process(mocks.Connection.Object, new SmtpCommand("HELO foo.blah"));

            mocks.VerifyWriteResponse(StandardSmtpResponseCode.BadSequenceOfCommands);
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:11,代码来源:HeloVerbTests.cs

示例5: TestBadAddress

        private void TestBadAddress(string address)
        {
            Mocks mocks = new Mocks();
            Message message = new Message(mocks.Session.Object);
            mocks.Connection.SetupGet(c => c.CurrentMessage).Returns(message);

            RcptToVerb verb = new RcptToVerb();
            verb.Process(mocks.Connection.Object, new SmtpCommand("TO " + address));

            mocks.VerifyWriteResponse(StandardSmtpResponseCode.SyntaxErrorInCommandArguments);
            Assert.AreEqual(0, message.To.Length);
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:12,代码来源:RcptToVerbTests.cs

示例6: TestGoodAddress

        private void TestGoodAddress(string address, string expectedAddress)
        {
            Mocks mocks = new Mocks();
            Message message = new Message(mocks.Session.Object);
            mocks.Connection.SetupGet(c => c.CurrentMessage).Returns(message);

            RcptToVerb verb = new RcptToVerb();
            verb.Process(mocks.Connection.Object, new SmtpCommand("TO " + address));

            mocks.VerifyWriteResponse(StandardSmtpResponseCode.OK);
            Assert.AreEqual(expectedAddress, message.To[0]);
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:12,代码来源:RcptToVerbTests.cs

示例7: TestGoodData

        private void TestGoodData(string[] messageData, string expectedData)
        {
            Mocks mocks = new Mocks();

            Message message = new Message(mocks.Session.Object);
            mocks.Connection.SetupGet(c => c.CurrentMessage).Returns(message);
            mocks.ServerBehaviour.Setup(b => b.GetMaximumMessageSize(It.IsAny<IConnection>())).Returns((long?)null);

            int messageLine = 0;
            mocks.Connection.Setup(c => c.ReadLine()).Returns(() => messageData[messageLine++]);

            DataVerb verb = new DataVerb();
            verb.Process(mocks.Connection.Object, new SmtpCommand("DATA"));

            mocks.VerifyWriteResponse(StandardSmtpResponseCode.StartMailInputEndWithDot);
            mocks.VerifyWriteResponse(StandardSmtpResponseCode.OK);

            using (StreamReader dataReader = new StreamReader(message.GetData(), Encoding.ASCII))
            {
                Assert.AreEqual(expectedData, dataReader.ReadToEnd());
            }
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:22,代码来源:DataVerbTests.cs

示例8: Data_NoCurrentMessage_ReturnsError

        public void Data_NoCurrentMessage_ReturnsError()
        {
            Mocks mocks = new Mocks();

            DataVerb verb = new DataVerb();
            verb.Process(mocks.Connection.Object, new SmtpCommand("DATA"));

            mocks.VerifyWriteResponse(StandardSmtpResponseCode.BadSequenceOfCommands);
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:9,代码来源:DataVerbTests.cs


注:本文中的Mocks.VerifyWriteResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。