public void when_get_consumer_with_invalid_arguments_it_should_fail() { var registry = new DefaultConsumerRegistry(); Action sut = () => registry.Get <int, string>(api: null); sut.Should().ThrowExactly <ArgumentNullException>().Where(exception => exception.ParamName.Equals("api")); }
public void when_get_consumer_for_not_registered_api_it_should_fail() { var registry = new DefaultConsumerRegistry(); Action sut = () => registry.Get <int, string>(Mock.Of <IIngressApi>()); sut.Should().ThrowExactly <ArgumentException>().Where( exception => exception.ParamName.Equals("api"), "it's not possible to get consumer for not registered API"); }
public void when_add_consumer_with_valid_arguments_it_should_be_possible_to_get_it_back() { var sut = new DefaultConsumerRegistry(); var expectedConsumer = Mock.Of <IApiConsumer <int, string> >(); var api = Mock.Of <IIngressApi>(); sut.Add(api, expectedConsumer); sut.Get <int, string>(api).Should().BeSameAs(expectedConsumer, "the same consumer should be returned"); }