Ejemplo n.º 1
0
        public virtual async Task WriteOutput(HttpContext httpContext)
        {
            var allItems = await EndpointManager.All(this.httpClient);

            var content = await this.viewRenderService.RenderToStringAsync("~/views/UmiStatus.cshtml", allItems, options.LocatorUrl);

            await httpContext.Response.WriteAsync(content);
        }
Ejemplo n.º 2
0
        public async Task RegisterTwoEndpoints()
        {
            var httpApiEndpoint = "http://someapi.atsomedomain.com/v1".RegisterAsEndpoint();
            var uriApiEndpoint  = new Uri("http://www.google.com").RegisterAsEndpoint();
            var result          = await EndpointManager.All();

            Assert.AreEqual(2, result.Count);
        }
Ejemplo n.º 3
0
        public virtual async Task WriteOutput(HttpContext httpContext)
        {
            var allItems = await EndpointManager.All(this.httpClient);

            httpContext.Response.ContentType = "application/json";
            // worst json serialiser ever
            await httpContext.Response.WriteAsync($@"{{ ""urls"": [{string.Join(",", allItems.Select(x => $@"{{ ""uri"": {StringOrNull(x.Uri)}, ""ok"": {x.TestResult.Ok.ToString().ToLower()}, ""tested"": {(int)x.TestResult.StatusCode}, ""testTo"": {(int)x.TestConfiguration.TestAsSuccessStatusCode}, ""category"": {StringOrNull(x.TestConfiguration.Category)}}}"))}]}}");
        }
Ejemplo n.º 4
0
        public async Task RegisterTwoEndpoints()
        {
            var httpApiEndpoint = "http://someapi.atsomedomain.com/v1".RegisterAsEndpoint();
            var uriApiEndpoint  = new Uri("http://www.google.com").RegisterAsEndpoint();
            var httpClientMock  = new Mock <IHttpClient>();

            httpClientMock.Setup(x => x.SendAsync(It.IsAny <HttpRequestMessage>())).Returns(Task.FromResult(new HttpResponseMessage(System.Net.HttpStatusCode.Accepted)));
            var result = await EndpointManager.All(httpClientMock.Object);

            Assert.AreEqual(2, result.Count);
        }