예제 #1
0
        public async Task ResolveNameAsync_MixedAddressAndRecordTypes_OnlyIncludesVaildRecords(string address, FlatRecordType recordType)
        {
            // Arrange
            Mock <ILocalDNS> mockLocalDNS = BuildMockLocalDNS(IPv4Address, IPv6Address);

            SystemDNSResolver resolver = new SystemDNSResolver(mockLocalDNS.Object);

            // Act

            List <FlatTargetRecord> result = await resolver.ResolveNameAsync(It.IsAny <string>(), recordType);

            // Assert

            Assert.Equal(address, result.Single().Address);
        }
예제 #2
0
        public async Task ResolveNameAsync_SingleAddressCorrectRecordType_HasAdress(string address, FlatRecordType recordType)
        {
            // Arrange

            Mock <ILocalDNS> mockLocalDNS = BuildMockLocalDNS(address);

            SystemDNSResolver resolver = new SystemDNSResolver(mockLocalDNS.Object);

            // Act

            List <FlatTargetRecord> result = await resolver.ResolveNameAsync(It.IsAny <string>(), recordType);

            // Assert

            Assert.Equal(address, result.Single().Address);
        }
예제 #3
0
        public async Task ResolveNameAsync_SingleAddressIncorrectRecordType_DoesNotIncludeIncorrectRecords(string address, FlatRecordType recordType)
        {
            // Arrange

            Mock <ILocalDNS> mockLocalDNS = BuildMockLocalDNS(address);

            SystemDNSResolver resolver = new SystemDNSResolver(mockLocalDNS.Object);

            // Act

            List <FlatTargetRecord> result = await resolver.ResolveNameAsync(It.IsAny <string>(), recordType);

            // Assert

            Assert.Empty(result);
        }
예제 #4
0
        public async Task ResolveNameAsync_SingleAddress_TTLIsNull()
        {
            // Arrange

            Mock <ILocalDNS> mockLocalDNS = BuildMockLocalDNS(IPv4Address);

            SystemDNSResolver resolver = new SystemDNSResolver(mockLocalDNS.Object);

            // Act

            List <FlatTargetRecord> result = await resolver.ResolveNameAsync(It.IsAny <string>(), FlatRecordType.A);

            // Assert

            Assert.False(result.Single().TTL.HasValue);
        }