コード例 #1
0
        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>();
        }
コード例 #2
0
        public void constructor_should_initialize_instance()
        {
            var eventSubscriber = Mock.Of <IEventSubscriber>();

            var result = new DnsMonitorFactory(eventSubscriber);

            result._eventSubscriber().Should().BeSameAs(eventSubscriber);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public static IEventSubscriber _eventSubscriber(this DnsMonitorFactory obj) => (IEventSubscriber)Reflector.GetFieldValue(obj, nameof(_eventSubscriber));
コード例 #5
0
 public static IDnsResolver _dnsResolver(this DnsMonitorFactory obj) => (IDnsResolver)Reflector.GetFieldValue(obj, nameof(_dnsResolver));