public void constructor_should_use_DnsClientWrapper_when_dnsResolver_is_null() { var eventSubscriber = Mock.Of <IEventSubscriber>(); var result = new DnsMonitorFactory(eventSubscriber, dnsResolver: null); result._dnsResolver().Should().BeOfType <DnsClientWrapper>(); }
public void constructor_should_initialize_instance() { var eventSubscriber = Mock.Of <IEventSubscriber>(); var result = new DnsMonitorFactory(eventSubscriber); result._eventSubscriber().Should().BeSameAs(eventSubscriber); }
public void CreateDnsMonitor_should_return_expected_result() { var mockEventSubscriber = new Mock <IEventSubscriber>(); var subject = new DnsMonitorFactory(mockEventSubscriber.Object); var cluster = Mock.Of <IDnsMonitoringCluster>(); var lookupDomainName = "a.b.com"; var cancellationToken = new CancellationTokenSource().Token; var result = subject.CreateDnsMonitor(cluster, lookupDomainName, cancellationToken); var dnsMonitor = result.Should().BeOfType <DnsMonitor>().Subject; dnsMonitor._cluster().Should().BeSameAs(cluster); dnsMonitor._lookupDomainName().Should().Be(lookupDomainName); dnsMonitor._cancellationToken().Should().Be(cancellationToken); Action <SdamInformationEvent> sdamInformationEventHandler; mockEventSubscriber.Verify(m => m.TryGetEventHandler <SdamInformationEvent>(out sdamInformationEventHandler), Times.Once); }
public static IEventSubscriber _eventSubscriber(this DnsMonitorFactory obj) => (IEventSubscriber)Reflector.GetFieldValue(obj, nameof(_eventSubscriber));
public static IDnsResolver _dnsResolver(this DnsMonitorFactory obj) => (IDnsResolver)Reflector.GetFieldValue(obj, nameof(_dnsResolver));