Пример #1
0
        public void Setup()
        {
            monitorCache = mockMonitorCache.Object;
            factory      = mockFactory.Object;
            publisher    = mockPublisher.Object;
            address      = mockAddress.Object;
            monitor      = mockMonitor.Object;

            mockFactory
            .Setup(m => m.CreatePublisher(It.IsIn(address)))
            .Returns(publisher);

            mockFactory
            .SetupGet(m => m.PublisherMonitor)
            .Returns(monitor);

            mockFactory
            .SetupGet(m => m.PublisherType)
            .Returns(typeof(IPublisher));

            mockAddress
            .Setup(m => m.ToString())
            .Returns("address");

            mockAddress
            .Setup(m => m.GetHashCode())
            .Returns(1);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of <see cref="TransportFactory{TSender, TReceiver, TPublisher, TSubscriber}"/>
 /// </summary>
 /// <param name="senderMonitor">Monitor that <see cref="TSender"/>s will be added to</param>
 /// <param name="receiverMonitor">Monitor that <see cref="TReceiver"/>s will be added to</param>
 public TransportFactory(
     ISenderMonitor <TSender> senderMonitor,
     IReceiverMonitor <TReceiver> receiverMonitor,
     IPublisherMonitor <TPublisher> publisherMonitor,
     ISubscriberMonitor <TSubscriber> subscriberMonitor)
 {
     this.senderMonitor     = senderMonitor;
     this.receiverMonitor   = receiverMonitor;
     this.publisherMonitor  = publisherMonitor;
     this.subscriberMonitor = subscriberMonitor;
 }