本文整理汇总了C#中IModel.Stub方法的典型用法代码示例。如果您正苦于以下问题:C# IModel.Stub方法的具体用法?C# IModel.Stub怎么用?C# IModel.Stub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IModel
的用法示例。
在下文中一共展示了IModel.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: SetupModel
protected void SetupModel(QueueEndpoint endPoint, IBasicProperties properties, byte[] data)
{
Model = MockRepository.GenerateStub<IModel>();
Model.Stub(x => x.QueueDeclare(endPoint.RoutingKey, false, false, false, null))
.Return(new QueueDeclareOk(endPoint.RoutingKey, 1, 1));
Model.Stub(x => x.CreateBasicProperties())
.Return(properties);
Model.Stub(x => x.BasicPublish(Exchange != null ? Exchange.Name : null, endPoint.RoutingKey, properties, data));
}