예제 #1
0
        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);
            });
        }
예제 #2
0
        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);
            });
        }
예제 #3
0
        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);
            });
        }
예제 #4
0
        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));
        }
예제 #5
0
        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));
        }
예제 #6
0
        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);
        }