コード例 #1
0
        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);
        }