public void MicroserviceHostWithoutMicroServiceAttributeFails() { MicroserviceConfigurationException ex = Assert.Throws <MicroserviceConfigurationException>(() => { using (var host = new MicroserviceHost <BusOptions>()) { } }); Assert.Equal("No [MicroService] interfaces have been found.", ex.Message); }
public void MicroserviceHostWithoutHandlersFails() { var serviceMock = new EmptyServiceMock(); MicroserviceConfigurationException ex = Assert.Throws <MicroserviceConfigurationException>(() => { using (var host = new MicroserviceHost <EmptyServiceMock>(serviceMock)) { } }); Assert.Equal("No Handlers can be found in the Microservice interface.", ex.Message); }
public void MicroserviceHostWithoutConfiguredQueueNameFails() { var serviceMock = new ServiceWithoutQueueMock(); MicroserviceConfigurationException ex = Assert.Throws <MicroserviceConfigurationException>(() => { using (var host = new MicroserviceHost <ServiceWithoutQueueMock>(serviceMock)) { host.Open(); } }); Assert.Equal("No queue name is configured in the MicroserviceAtrribute on any Microservice interface nor in the Busoptions.", ex.Message); }
public void MicroserviceHostFailsIfRabbitMQIsNotReachable() { var serviceMock = new SomeMicroserviceMock(); var options = new BusOptions { HostName = "NonExistingName" }; MicroserviceConfigurationException ex = Assert.Throws <MicroserviceConfigurationException>(() => { using (var host = new MicroserviceHost <SomeMicroserviceMock>(serviceMock, options)) { host.Open(); } }); Assert.Equal("The Eventbus (RabbitMQ service) cannot be reached.", ex.Message); }