本文整理汇总了C#中IConnection.Stub方法的典型用法代码示例。如果您正苦于以下问题:C# IConnection.Stub方法的具体用法?C# IConnection.Stub怎么用?C# IConnection.Stub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConnection
的用法示例。
在下文中一共展示了IConnection.Stub方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
_model = MockRepository.GenerateMock<IModel>();
_model.Stub(x => x.CreateBasicProperties())
.Return(new BasicProperties());
_model.Stub(x => x.BasicPublish(null, null, null, null))
.IgnoreArguments();
_model.Replay();
_connection = MockRepository.GenerateMock<IConnection>();
_connection.Stub(x => x.CreateModel()).Return(_model);
_connection.Replay();
_connectionFactory = MockRepository.GenerateMock<IConnectionFactory>();
_connectionFactory.Stub(x => x.CreateConnection()).Return(_connection);
_connectionFactory.Replay();
_logger = MockRepository.GenerateMock<IEasyNetQLogger>();
_logger.Replay();
_fallbackStrategy = MockRepository.GenerateMock<IConsumerErrorStrategy>();
_fallbackStrategy.Stub(x => x.HandleConsumerError(null, null))
.IgnoreArguments();
_fallbackStrategy.Replay();
_sut = new RetryConsumerErrorStrategy(
_connectionFactory,
_fallbackStrategy,
_logger);
}
示例2: CreateFactoryMock
private ConnectionFactory CreateFactoryMock(QueueEndpoint endPoint, IBasicProperties properties, byte[] data)
{
SetupModel(endPoint, properties, data);
Connection = MockRepository.GenerateStub<IConnection>();
Connection
.Stub(x => x.CreateModel())
.Return(Model);
var factory = MockRepository.GenerateStub<ConnectionFactory>();
factory.Stub(x => x.CreateConnection())
.Return(Connection);
return factory;
}