public void constructor_should_initialize_instance() { var cluster = Mock.Of <IDnsMonitoringCluster>(); var dnsResolver = Mock.Of <IDnsResolver>(); var lookupDomainName = "a.b.com"; var mockEventSubscriber = new Mock <IEventSubscriber>(); var sdamInformationEventHandler = (Action <SdamInformationEvent>)(e => { }); mockEventSubscriber .Setup(m => m.TryGetEventHandler <SdamInformationEvent>(out sdamInformationEventHandler)) .Returns(true); var cancellationToken = new CancellationTokenSource().Token; var subject = new DnsMonitor(cluster, dnsResolver, lookupDomainName, mockEventSubscriber.Object, cancellationToken); subject.State.Should().Be(DnsMonitorState.Created); subject._cancellationToken().Should().Be(cancellationToken); subject._cluster().Should().BeSameAs(cluster); subject._dnsResolver().Should().BeSameAs(dnsResolver); subject._lookupDomainName().Should().Be("a.b.com"); subject._processDnsResultHasEverBeenCalled().Should().BeFalse(); subject._sdamInformationEventHandler().Should().Be(sdamInformationEventHandler); subject._service().Should().Be("_mongodb._tcp.a.b.com"); subject._unhandledException().Should().BeNull(); }
public static void Monitor(this DnsMonitor obj) => Reflector.Invoke(obj, nameof(Monitor));
public static List <DnsEndPoint> GetValidEndPoints(this DnsMonitor obj, List <SrvRecord> srvRecords) => (List <DnsEndPoint>)Reflector.Invoke(obj, nameof(GetValidEndPoints), srvRecords);
public static bool IsValidHost(this DnsMonitor obj, DnsEndPoint endPoint) => (bool)Reflector.Invoke(obj, nameof(IsValidHost), endPoint);
public static Exception _unhandledException(this DnsMonitor obj) => (Exception)Reflector.GetFieldValue(obj, nameof(_unhandledException));
public static TimeSpan ComputeRescanDelay(this DnsMonitor obj, List <SrvRecord> srvRecords) => (TimeSpan)Reflector.Invoke(obj, nameof(ComputeRescanDelay), srvRecords);
public static Action <SdamInformationEvent> _sdamInformationEventHandler(this DnsMonitor obj) => (Action <SdamInformationEvent>)Reflector.GetFieldValue(obj, nameof(_sdamInformationEventHandler));
public static string _service(this DnsMonitor obj) => (string)Reflector.GetFieldValue(obj, nameof(_service));
public static bool _processDnsResultHasEverBeenCalled(this DnsMonitor obj) => (bool)Reflector.GetFieldValue(obj, nameof(_processDnsResultHasEverBeenCalled));
public static string _lookupDomainName(this DnsMonitor obj) => (string)Reflector.GetFieldValue(obj, nameof(_lookupDomainName));
public static IDnsResolver _dnsResolver(this DnsMonitor obj) => (IDnsResolver)Reflector.GetFieldValue(obj, nameof(_dnsResolver));
public static IDnsMonitoringCluster _cluster(this DnsMonitor obj) => (IDnsMonitoringCluster)Reflector.GetFieldValue(obj, nameof(_cluster));
public static CancellationToken _cancellationToken(this DnsMonitor obj) => (CancellationToken)Reflector.GetFieldValue(obj, nameof(_cancellationToken));