public void ShouldNotDisposeOfChannelManagerDuringFinalise()
        {
            this.componentUnderTest = null;
             GC.Collect();
             GC.WaitForPendingFinalizers();

             A.CallTo(() => this.ChannelManager.Dispose()).MustNotHaveHappened();
        }
        public void SetupBeforeEachTest()
        {
            this.messageSubscription = A.Fake<IMessageSubscription>();

             A.CallTo(() => this.MessageSubscriptionFactory.Create(A<IChannelManagerFactory>._, A<Type[]>._)).Returns(this.messageSubscription);

             this.componentUnderTest = this.CreateRabbitMQServiceBus();
        }
        public static void AddRabbitMQServiceBus(this IServiceCollection coll, Action <IRabbitMqReceiveEndpointConfigurator> config, string queueName = null)
        {
            var bus = new RabbitMQServiceBus(config);

            BusConfig.Current = new BusConfig
            {
                EndPointId = queueName ?? Shell.ProjectAssembly.GetName().Name
            };
            coll.AddSingleton <IServiceBus>(bus);
        }
        protected RabbitMQServiceBus CreateRabbitMQServiceBus()
        {
            var serviceBus = new RabbitMQServiceBus(
            this.ChannelManagerFactory,
            this.QueueNameConvention,
            this.MessageSubscriptionFactory,
            this.MessageEncoder,
            this.MessageSerialiser,
            this.Logger);

             return serviceBus;
        }
Example #5
0
        public void setup_before_each_test()
        {
            _connectionFactory     = A.Fake <IConnectionFactory>();
            _connection            = A.Fake <IConnection>();
            _channel               = A.Fake <IModel>();
            _queueNameStrategy     = new DefaultQueueNameStrategy();
            _serialisationStrategy = new DefaultSerialisationStrategy();

            A.CallTo(() => _connectionFactory.CreateConnection()).Returns(_connection);
            A.CallTo(() => _connection.CreateModel()).Returns(_channel);

            _testSubject = new RabbitMQServiceBus(_connectionFactory, _queueNameStrategy, _serialisationStrategy, A.Fake <IMessageProcessor>());
        }
        public void SetupBeforeEachTest()
        {
            this.channel = A.Fake<IModel>();

             A.CallTo(() => this.ChannelManager.CreateChannel()).Returns(this.channel);

             this.componentUnderTest = this.CreateRabbitMQServiceBus();
        }
 public void SetupBeforeEachTest()
 {
     this.componentUnderTest = this.CreateRabbitMQServiceBus();
 }
        public void ShouldNotDisposeSubscriptionDuringFinalise()
        {
            this.componentUnderTest.Receive(typeof(TestMessageAHandler));

             this.componentUnderTest = null;
             GC.Collect();
             GC.WaitForPendingFinalizers();

             A.CallTo(() => this.messageSubscription.Dispose()).MustNotHaveHappened();
        }