Exemplo n.º 1
0
        public void Setup()
        {
            topicRouter        = mockTopicRouter.Object;
            monitorCache       = mockMonitorCache.Object;
            subscriptionsCache = mockSubscriptionsCache.Object;
            subscriberFactory  = mockSubscriberFactory.Object;
            subscriber         = mockSubscriber.Object;
            monitor            = mockMonitor.Object;
            address            = TcpAddress.Localhost(5555);
            routing            = SubscriberRouting.For <ISubscriber>(address);

            mockTopicRouter
            .Setup(m => m.RoutingFor <Topic>(out routing))
            .Returns(true);

            mockSubscriberFactory
            .Setup(m => m.CreateSubscriber(It.IsAny <IAddress>()))
            .Returns(subscriber);

            mockSubscriberFactory
            .SetupGet(m => m.SubscriberType)
            .Returns(typeof(ISubscriber));

            mockSubscriberFactory
            .SetupGet(m => m.SubscriberMonitor)
            .Returns(monitor);
        }
Exemplo n.º 2
0
        public void For_WithNullAddress_ThrowsArgumentNullException()
        {
            // Act
            TestDelegate create = () => SubscriberRouting.For <ISubscriber>(null);

            // Assert
            Assert.That(create, Throws.ArgumentNullException);
        }
Exemplo n.º 3
0
        public void For_WithAddress_ReturnsSameAddress()
        {
            // Arrange
            var routing = SubscriberRouting.For <ISubscriber>(address);

            // Act
            var subscriberAddress = routing.Address;

            // Assert
            Assert.That(subscriberAddress, Is.EqualTo(address));
        }
Exemplo n.º 4
0
        public void For_WithAddress_HasSubscriberType()
        {
            // Arrange
            var routing = SubscriberRouting.For <ISubscriber>(address);

            // Act
            var subscriberType = routing.SubscriberType;

            // Assert
            Assert.That(subscriberType, Is.EqualTo(typeof(ISubscriber)));
        }