public void PauseThrowsExceptionIfAlreadyPaused() { // Arrange var context = new TestBusContext(); var receiver = new TestCommandReceiver(context, "queue"); receiver.DeclareCommandQueue(); receiver.Pause(); // Act void Act() => receiver.Pause(); // Assert BusConfigurationException exception = Assert.ThrowsException <BusConfigurationException>(Act); Assert.AreEqual("Attempting to pause the TestCommandReceiver, but it was already paused.", exception.Message); }
public void PausePausesReceiver() { // Arrange var context = new TestBusContext(); var receiver = new TestCommandReceiver(context, "queue"); receiver.DeclareCommandQueue(); // Act receiver.Pause(); // Assert Assert.IsTrue(receiver.IsPaused); }
public void PauseThrowsExceptionWhenQueueNotDeclared() { // Arrange var context = new TestBusContext(); var receiver = new TestCommandReceiver(context, "queue"); // Act void Act() => receiver.Pause(); // Assert BusConfigurationException exception = Assert.ThrowsException <BusConfigurationException>(Act); Assert.AreEqual("Attempting to pause the TestCommandReceiver, but it is not even receiving messages.", exception.Message); }