コード例 #1
0
        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()));
        }
コード例 #2
0
 public Endpoint GetRoutedEndpoint(Uri endpoint)
 {
     Uri newEndpoint = null;
     mapping.Read(reader => reader.TryGetValue(endpoint.NormalizeLocalhost(), out newEndpoint));
     return new Endpoint
     {
         Uri = newEndpoint ?? endpoint
     };
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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()));
 }
コード例 #6
0
 public void RemapEndpoint(Uri originalEndpoint, Uri newEndpoint)
 {
     mapping.Write(writer => writer.Add(originalEndpoint.NormalizeLocalhost(), newEndpoint.NormalizeLocalhost()));
 }