Example #1
0
        public async Task CanPingServer(string rootUrl)
        {
            var gateway  = new PortalGateway(rootUrl);
            var endpoint = new ArcGISServerEndpoint("/");

            var response = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
            {
                return(gateway.Ping(endpoint));
            });

            Assert.Null(response.Error);
        }
Example #2
0
        public async Task CanDescribeSite(string rootUrl)
        {
            var gateway  = new PortalGateway(rootUrl);
            var response = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
            {
                return(gateway.DescribeSite());
            });

            Assert.NotNull(response);
            Assert.True(response.Version > 0);

            foreach (var resource in response.ArcGISServerEndpoints.Where(e => e.RelativeUrl.EndsWith("server", StringComparison.OrdinalIgnoreCase) && !e.RelativeUrl.EndsWith("searchserver", StringComparison.OrdinalIgnoreCase)))
            {
                var ping = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
                {
                    return(gateway.Ping(resource));
                });

                Assert.Null(ping.Error);
            }
        }
        public async Task CanDescribeSite(string rootUrl)
        {
            var gateway  = new PortalGateway(rootUrl);
            var response = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
            {
                return(gateway.DescribeSite());
            });

            Assert.NotNull(response);
            Assert.True(response.Version > 0);

            foreach (var resource in response.ArcGISServerEndpoints)
            {
                var ping = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
                {
                    return(gateway.Ping(resource));
                });

                Assert.Null(ping.Error);
            }
        }
        public async Task CannotAccessSecureResourceWithoutToken(string rootUrl, string relativeUrl)
        {
            var gateway  = new PortalGateway(rootUrl);
            var endpoint = new ArcGISServerEndpoint(relativeUrl);

            var exception = await Assert.ThrowsAsync <InvalidOperationException>(() => gateway.Ping(endpoint));

            Assert.NotNull(exception);
            Assert.Contains("token required.", exception.Message.ToLowerInvariant());
        }