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(); }
public void Dispose_DoesNotThrow_WhenCertificateNotSet() { var serviceBusBuilder = new ServiceBusBuilder(Substitute.For <ISimulation>()); var serviceBusSimulator = new ServiceBusSimulator(serviceBusBuilder); Action action = () => serviceBusSimulator.Dispose(); action.ShouldNotThrow(); }
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); }
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())); }
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())); }