protected override void Given() { _port = 0; _hostName = "host"; _mapper = Fixture.Freeze <IDnsEndpointMapper>(); _mapper.CallsTo(x => x.GetIPEndPoint(_hostName, _port)).Returns(null); }
private StatsDUdpClient(IDnsEndpointMapper endpointMapper, string hostNameOrAddress, int port) { _endPointMapper = endpointMapper; _hostNameOrAddress = hostNameOrAddress; _port = port; //if we were given an IP instead of a hostname, we can happily cache it off for the life of this class IPAddress address; if (IPAddress.TryParse(hostNameOrAddress, out address)) { _ipBasedEndpoint = new IPEndPoint(address, _port); } }
/// <summary> /// </summary> /// <param name="baseMapper">Base endpoint provider</param> /// <param name="secondsCacheDuration">Seconds to cache ip endpoints for</param> public CachedDnsEndpointMapper(IDnsEndpointMapper baseMapper, int secondsCacheDuration) { _baseMapper = baseMapper; _secondsCacheDuration = secondsCacheDuration; }