public async Task HostnameToIpResolver_can_resolveAsync()
        {
            var resolver = new HostnameToIpResolver();
            var ip       = await resolver.ResolveToIpv4Async("localhost");

            Assert.Equal("127.0.0.1", ip);
        }
        public async Task HostnameToIpResolve_can_fail()
        {
            var resolver  = new HostnameToIpResolver();
            var exception =
                await Record.ExceptionAsync(async() => await resolver.ResolveToIpv4Async("this-host-is-invalid"));

            Assert.NotNull(exception);

            Assert.IsAssignableFrom <SocketException>(exception);
        }
Ejemplo n.º 3
0
 public UriWithHostnameToUriWithIpTest()
 {
     _resolver = A.Fake <HostnameToIpResolver>();
     A.CallTo(() => _resolver.ResolveToIpv4Async(A <string> ._)).Returns(Task.FromResult("127.0.0.1"));
 }