public void when_get_api_by_queue_name_it_should_return_api_handling_messages_from_this_queue_name() { var(configuration, serviceProvider) = ConfigurationTests.CreateBrokerIngressConfigurationWithTwoApisHandlingMessageFromDifferentQueues(); var ingress = new BrokerIngress( Mock.Of <IMessageBroker>(), configuration, serviceProvider); ingress.Initialize(); ingress.GetApiByQueueName("queue1").Id.Should().Be("api1", "api1 configured to handle messages from queue1"); ingress.GetApiByQueueName("queue2").Id.Should().Be("api2", "api2 configured to handle messages from queue2"); }
public void when_get_api_by_queue_name_and_a_few_apis_handle_messages_from_same_queue_it_should_fail() { var(configuration, serviceProvider) = ConfigurationTests.CreateBrokerIngressConfigurationWithTwoApisHandlingMessageFromAnyQueue(); var ingress = new BrokerIngress( Mock.Of <IMessageBroker>(), configuration, serviceProvider); ingress.Initialize(); const string queueName = "queue-name"; Action sut = () => ingress.GetApiByQueueName(queueName); sut.Should().ThrowExactly <PoezdOperationException>().Which.Message.Should().Contain("belongs to a few APIs"); sut.Should().ThrowExactly <PoezdOperationException>().Which.Message.Should().Contain(queueName); }