public void Setup()
 {
     Dispatch           = ResponseAwaiterDispatchTestObjects.GetProperResponseAwaiterDispatch();
     NormalOrder        = ProtocolTestObjects.GetNormalOrder();
     NormalConfirmation = ProtocolTestObjects.GetNormalConfirmation();
     NormalReply        = ProtocolTestObjects.GetNormalReply();
 }
예제 #2
0
        private void Setup()
        {
            var partFactory = PartFactoryTestObjects.GetAlwaysValidPartFactory();

            CommandFactory = CommandsTestObjects.GetProperAlwaysValidCommandFactory();
            var idGenerator         = new IdGenerator(4);
            var dataPackFactory     = new ReflectionBasedDataPackFactory();
            var orderFactory        = new OrderFactory(idGenerator, dataPackFactory);
            var replyFactory        = new ReplyFactory(idGenerator);
            var confirmationFactory = new ConfirmationFactory();

            Mock <IDataStreamSplitter>       splitter  = new Mock <IDataStreamSplitter>();
            Mock <ICommunicationDeviceAsync> comDevice = new Mock <ICommunicationDeviceAsync>();
            var translator = new CommandTranslator(new OrderCommandTranslator(partFactory, CommandFactory, orderFactory),
                                                   new ReplyCommandTranslator(partFactory, CommandFactory, replyFactory),
                                                   new ConfirmationCommandTranslator(partFactory, CommandFactory, confirmationFactory), new ErrorCommandTranslator());

            Translator = translator;

            Mock <IDeviceHandler> handler = new Mock <IDeviceHandler>();

            handler.Setup(h => h.SendAsync(It.IsAny <ICommand>())).ReturnsAsync(true);

            DeviceMoq = handler;
            ResponseAwaiterDispatch = ResponseAwaiterDispatchTestObjects.GetProperResponseAwaiterDispatch();
            ProtocolHandler         = new ProtocolHandlerTestWrapper(handler.Object, confirmationFactory, replyFactory, orderFactory, translator, ResponseAwaiterDispatch);
        }
예제 #3
0
 public ProtocolHandlerTestWrapper(IDeviceHandler deviceHandler, ConfirmationFactory confirmationFactory, ReplyFactory replyFactory, OrderFactory orderFactory, CommandTranslator commandTranslator, ResponseAwaiterDispatch awaiterDispatch)
     : base(deviceHandler, confirmationFactory, replyFactory, orderFactory, commandTranslator, awaiterDispatch)
 {
 }