コード例 #1
0
        public async Task PublicIPResolver_ResolveIPv6_ReturnsTheFirstNonNullIP()
        {
            // Given
            var resolver = new PublicIPResolver(_mockNullResolver.Object, _mockNullResolver.Object, _mockResolver2.Object, _mockResolver.Object);

            // When
            var ip = await resolver.ResolveIPv6();

            // Then
            ip.Should().BeEquivalentTo(IPAddress.Parse("2001:0db8:85a3:0000:0000:8a2e:0370:5555"));
        }
コード例 #2
0
        public async Task PublicIPResolver_ResolveIPv6_ReturnsNullWhenNoResolverReturnsAnIP()
        {
            // Given
            var resolver = new PublicIPResolver(_mockNullResolver.Object, _mockNullResolver.Object);

            // When
            var ip = await resolver.ResolveIPv6();

            //
            Assert.Null(ip);
        }
コード例 #3
0
        public async Task PublicIPResolver_ResolveIPv4_ReturnsTheFirstNonNullIP()
        {
            // Given
            var resolver = new PublicIPResolver(_mockNullResolver.Object, _mockNullResolver.Object, _mockResolver2.Object, _mockResolver.Object);

            // When
            var ip = await resolver.ResolveIPv4();

            // Then
            ip.Should().BeEquivalentTo(IPAddress.Parse("10.0.0.2"));
        }