public void can_handle_localhost_consistently() { var uri = new Uri("http://lOcAlHoSt/blahdee"); var normalizedUri = uri.NormalizeLocalhost(); normalizedUri.ToString().ShouldBe("http://{0}/blahdee".ToFormat(System.Environment.MachineName.ToLower())); }
public Endpoint GetRoutedEndpoint(Uri endpoint) { Uri newEndpoint = null; mapping.Read(reader => reader.TryGetValue(endpoint.NormalizeLocalhost(), out newEndpoint)); return new Endpoint { Uri = newEndpoint ?? endpoint }; }
public void can_handle_localhost_consistently_2() { var router = new EndpointRouter(); var uri = new Uri("http://127.0.0.1/blahdee"); var normalizedUri = uri.NormalizeLocalhost(); var routeFrom = new Uri("http://remotehost/zippee"); router.RemapEndpoint(routeFrom, uri); Assert.Equal(normalizedUri, router.GetRoutedEndpoint(routeFrom).Uri); }
public void can_handle_localhost_consistently() { var router = new EndpointRouter(); var uri = new Uri("http://lOcAlHoSt/blahdee"); var normalizedUri = uri.NormalizeLocalhost(); var routeTo = new Uri("http://remotehost/zippee"); router.RemapEndpoint(uri, routeTo); Assert.Equal(routeTo, router.GetRoutedEndpoint(normalizedUri).Uri); Assert.Equal(routeTo, router.GetRoutedEndpoint(uri).Uri); }
public void can_handle_localhost_consistently_2() { var uri = new Uri("http://127.0.0.1/blahdee"); var normalizedUri = uri.NormalizeLocalhost(); normalizedUri.ToString().ShouldEqual("http://{0}/blahdee".ToFormat(Environment.MachineName.ToLower())); }
public void RemapEndpoint(Uri originalEndpoint, Uri newEndpoint) { mapping.Write(writer => writer.Add(originalEndpoint.NormalizeLocalhost(), newEndpoint.NormalizeLocalhost())); }