public void Setup() { requestDispatcher = mockRequestDispatcher.Object; topicDispatcher = mockTopicDispatcher.Object; monitor = mockMonitor.Object; messageFactory = mockMessageFactory.Object; }
/// <summary> /// Initializes a new instance of <see cref="NetMQFactory"/> /// </summary> /// <param name="requestDispatcher"><see cref="IRequestDispatcher"/> that will route incoming messages</param> /// <param name="topicDispatcher"><see cref="ITopicDispatcher"/> that will route incoming topic messages</param> /// <param name="monitor">Monitor that all NetMQ transports will be added to</param> /// <param name="messageFactory">Factory for creating <see cref="NetMQMessage"/>s</param> public NetMQFactory( IRequestDispatcher requestDispatcher, ITopicDispatcher topicDispatcher, INetMQMonitor monitor, INetMQMessageFactory messageFactory ) : base(monitor, monitor, monitor, monitor) { if (monitor is null) { throw new ArgumentNullException(nameof(monitor)); } this.requestDispatcher = requestDispatcher ?? throw new ArgumentNullException(nameof(requestDispatcher)); this.topicDispatcher = topicDispatcher ?? throw new ArgumentNullException(nameof(topicDispatcher)); this.messageFactory = messageFactory ?? throw new ArgumentNullException(nameof(messageFactory)); this.monitor = monitor ?? throw new ArgumentNullException(nameof(monitor)); }
/// <summary> /// Initializes a new instance of <see cref="NetMQFactory"/> /// </summary> /// <param name="builder"></param> /// <param name="monitor"></param> /// <param name="messageFactory"></param> /// <returns></returns> public static NetMQFactory FromBuilder(Builder builder, INetMQMonitor monitor, INetMQMessageFactory messageFactory) => new NetMQFactory(builder.RequestDispatcher, builder.TopicDispatcher, monitor, messageFactory);