public void FindServiceUriByType(TestServiceType serviceType, string expectedUri) { var provider = new ServiceDiscoveryProvider(GetConfiguration(), ServiceDiscoveryOptions.Default); Uri uri = provider.GetService(serviceType); uri.AbsoluteUri.Should().Be(expectedUri); }
public void ThrowExceptionIfServiceDoesntExist() { var provider = new ServiceDiscoveryProvider(GetConfiguration(), ServiceDiscoveryOptions.Default); Action action = () => provider.GetService("doesntExist"); action.Should().Throw <ArgumentException>(); }
public void ThrowExceptionIfServiceTypeWithoutAttribute() { var provider = new ServiceDiscoveryProvider(GetConfiguration(), ServiceDiscoveryOptions.Default); Action action = () => provider.GetService(TestServiceType.WithtoutParameter); action.Should().Throw <ArgumentException>(); }
public void FindServiceUriByNameInAnotherSection() { var provider = new ServiceDiscoveryProvider( GetConfiguration(), new ServiceDiscoveryOptions() { SectionName = "ApiServices" }); Uri uri = provider.GetService("ToDos"); uri.AbsoluteUri.Should().Be("http://localhost:9004/"); }
public void AllowServiceNameAsHost(string serviceName) { var provider = new ServiceDiscoveryProvider(GetConfiguration(), new ServiceDiscoveryOptions() { AllowServiceNameAsHost = true }); Uri uri = provider.GetService(serviceName); uri.Scheme.Should().Be("http"); uri.Host.Should().Be(serviceName); uri.Port.Should().Be(80); }