public async Task GetVersions_ConnectionStringNotFound() { IVersionResolver resolver = new ServiceVersionResolver(new DummyNotFoundConnectionStringProvider(), 0, 5, 10000, 10000); await Assert.ThrowsAsync <ConnectionStringNotFoundException>(async() => { var value = await resolver.GetVersions().ConfigureAwait(false); }); }
public async Task GetVersions_NotFoundListening() { string connectionString = "http://localhost:65534/NonExistentService"; IVersionResolver resolver = new ServiceVersionResolver(new StaticConnectionStringProvider(connectionString), 0, 5, 10000, 10000); await Assert.ThrowsAsync(typeof(DependencyNotReachableException), async() => { await resolver.GetVersions().ConfigureAwait(false); }); }
public async Task GetVersions_NoEndpointListening() { string connectionString = "http://gibberish/nPVR"; IVersionResolver resolver = new ServiceVersionResolver(new StaticConnectionStringProvider(connectionString), 0, 5, 10000, 10000); await Assert.ThrowsAsync(typeof(DependencyNotReachableException), async() => { await resolver.GetVersions().ConfigureAwait(false); }); }
public async Task GetVersions_WrongEndpoint() { string connectionString = $"http://{ Constants.SpecificServiceHostname }:5000/api/v1"; IVersionResolver resolver = new ServiceVersionResolver(new StaticConnectionStringProvider(connectionString), 0, 5, 10000, 10000); var versions = await resolver.GetVersions().ConfigureAwait(false); Assert.Equal(1, versions.Count()); Assert.Equal(versions.First(), DependencyVersion.Parse(Constants.SpecificServiceVersion)); }
public async Task GetVersions_WrongEndpoint_ReturnedOk() { string connectionString = $"http://{ Constants.SpecificKestrelSelfHostHostname }:40500/not/the/real"; IVersionResolver resolver = new ServiceVersionResolver(new StaticConnectionStringProvider(connectionString), 0, 5, 10000, 10000); var versions = await resolver.GetVersions().ConfigureAwait(false); Assert.Equal(1, versions.Count()); Assert.Equal(versions.First(), DependencyVersionParser.Parse(Constants.SpecificKestrelSelfHostVersion, false)); }
public async Task GetVersions_EndpointWithoutNAMEInstalled() { string connectionString = $"http://{ Constants.SpecificServiceHostname }:5000/endpoint/before/name/middleware"; IVersionResolver resolver = new ServiceVersionResolver(new StaticConnectionStringProvider(connectionString), 0, 5, 10000, 10000); var ex = await Assert.ThrowsAsync <DependencyWithoutNAMEException>(async() => { await resolver.GetVersions().ConfigureAwait(false); }); Assert.Equal(NAMEStatusLevel.Warn, ex.StatusLevel); }