Ejemplo n.º 1
0
        public void Dispose_DoesNotThrow_WhenCalledTwice()
        {
            var serviceBusBuilder   = new ServiceBusBuilder(Substitute.For <ISimulation>());
            var serviceBusSimulator = new ServiceBusSimulator(serviceBusBuilder);

            Action action = () =>
            {
                serviceBusSimulator.Dispose();
                serviceBusSimulator.Dispose();
            };

            action.ShouldNotThrow();
        }
Ejemplo n.º 2
0
        public void Dispose_DoesNotThrow_WhenCertificateNotSet()
        {
            var serviceBusBuilder   = new ServiceBusBuilder(Substitute.For <ISimulation>());
            var serviceBusSimulator = new ServiceBusSimulator(serviceBusBuilder);

            Action action = () => serviceBusSimulator.Dispose();

            action.ShouldNotThrow();
        }
Ejemplo n.º 3
0
        public async Task Dispose_SetsStateToStopped()
        {
            var serviceBusBuilder   = new ServiceBusBuilder(Substitute.For <ISimulation>());
            var serviceBusSimulator = new ServiceBusSimulator(serviceBusBuilder);
            await serviceBusSimulator.StartAsync();

            serviceBusSimulator.Dispose();

            serviceBusSimulator.State.ShouldBe(SimulatorState.Stopped);
        }
Ejemplo n.º 4
0
        public void Dispose_DisposesTopics()
        {
            ServiceBusBuilder serviceBusBuilder = new ServiceBusBuilder(Substitute.For <ISimulation>())
                                                  .AddTopic("myTopic");
            var serviceBusSimulator = new ServiceBusSimulator(serviceBusBuilder);

            Entities.ITopic topic = serviceBusSimulator.Topics["myTopic"];

            serviceBusSimulator.Dispose();

            Should.Throw <ObjectDisposedException>(() => topic.Post(new Amqp.Message()));
        }
Ejemplo n.º 5
0
        public void Dispose_DisposesQueues()
        {
            ServiceBusBuilder serviceBusBuilder = new ServiceBusBuilder(Substitute.For <ISimulation>())
                                                  .AddQueue("myQueue");
            var serviceBusSimulator = new ServiceBusSimulator(serviceBusBuilder);

            Entities.IQueue queue = serviceBusSimulator.Queues["myQueue"];

            serviceBusSimulator.Dispose();

            Should.Throw <ObjectDisposedException>(() => queue.Post(new Amqp.Message()));
        }