/// <summary>
        /// Creates the router processor.
        /// </summary>
        /// <returns></returns>
        public IProcessor CreateRouterProcessor()
        {
            this.CreateInput()
            .LoadHelpers();

            return(ProcessorsFactory.CreateRouterProcessor(_identification, _input, _routerOutputHelper));
        }
        /// <summary>
        /// Creates the control processor.
        /// </summary>
        /// <returns></returns>
        public IController CreateControlProcessor()
        {
            this.CreateInput()
            .CreateOutput()
            .LoadHandlers();

            return(ProcessorsFactory.CreateControlProcessor(_identification, _input, _output, _handlerRepository));
        }
        public void Constructor_State_Initializing_True()
        {
            var subject = ProcessorsFactory.CreateRouterProcessor(_mockIdentification.Object,
                                                                  _mockInputGateway.Object,
                                                                  _mockRouterOutputHelper.Object);

            Assert.IsTrue(subject.Status == ProcessorStatus.Configured);
        }
        /// <summary>
        ///     Creates the control processor.
        /// </summary>
        /// <returns></returns>
        public IController CreateControlProcessor()
        {
            CreateInput()
            .LoadHandlers()
            .LoadPersisters()
            .LoadHelpers();

            return(ProcessorsFactory.CreateRouterControlProcessor(_identification, _input, _handlerRepository,
                                                                  _subscriptorsHelpers));
        }
Example #5
0
        public void Setup()
        {
            _mockIdentification    = new Mock <Identification>();
            _mockInputGateway      = new Mock <IInputGateway <IControlMessage, MessageHeader> >();
            _mockOutputGateway     = new Mock <IOutputGateway <IControlMessage> >();
            _mockHandlerRepository = new Mock <IHandlerRepository>();

            _subject = ProcessorsFactory.CreateControlProcessor(_mockIdentification.Object, _mockInputGateway.Object,
                                                                _mockOutputGateway.Object, _mockHandlerRepository.Object) as ControlProcessor;
        }
        public void Setup()
        {
            _mockInputGateway       = new Mock <IInputGateway <byte[], RouterHeader> >();
            _mockIdentification     = new Mock <Identification>();
            _mockRouterOutputHelper = new Mock <IRouterOutputHelper>();

            _subject = ProcessorsFactory.CreateRouterProcessor(_mockIdentification.Object,
                                                               _mockInputGateway.Object,
                                                               _mockRouterOutputHelper.Object) as RouterProcessor;
            _identification = new Identification {
                Id = "Test", Type = "Test_Type"
            };
        }
        public void Setup()
        {
            _mockIdentification    = new Mock <Identification>();
            _mockInputGateway      = new Mock <IInputGateway <IMessage, MessageHeader> >();
            _mockHandlerRepository = new Mock <IHandlerRepository>();
            _messageBuilder        = new Mock <IMessageBuilder>();

            _subject = ProcessorsFactory.CreateServiceProcessor(_mockIdentification.Object,
                                                                _mockInputGateway.Object,
                                                                _mockHandlerRepository.Object,
                                                                _messageBuilder.Object) as ServiceProcessor;

            _mockOutputGateway = new Mock <IOutputGateway <IMessage> >();
        }
Example #8
0
        //const long TEST_BOT_ID = -352873331;
        //const int EUGENIY_ID = 425552425;

        //Диана - 788918728
        //Вован - 355373744
        //Я - 193369564
        //Женек - 425552425
        //Рукс - 262531255


        //pack://application:,,,/Fonts/#Digital-7 Mono

        private async static void BotClient_OnMessage(object sender, MessageEventArgs e)
        {
            //UpdateUsers();

            var text = e?.Message?.Text;
            var id   = e.Message.Chat.Id;

            //var id = e.Message.From.Id;
            //var messageID = e?.Message?.MessageId;

            if (text == null)
            {
                return;
            }

            var           user      = employeeManager.Get(id);
            IMsgProcessor processor = new ProcessorsFactory().GetProcessor(botClient, user); //employeeManager.Get(id);

            if (user != null)
            {
                await processor.ProcessMessage(text);
            }
            else
            {
                var anon = new AnonymousMsgProcessor(botClient, new Anonymous()
                {
                    Id = id
                });
                await anon.ProcessMessage(text);
            }

            //if (e?.Message?.Chat.Id == 193369564) {
            //    await botClient.SendTextMessageAsync(
            //    chatId: 193369564,
            //    text: $"Борис только что написал: '{text}'"
            //    ).ConfigureAwait(false);

            //    await botClient.SendTextMessageAsync(
            //    chatId: e?.Message?.Chat.Id,
            //    text: $"You said '{text}'",
            //    replyMarkup: markupBoris
            //    ).ConfigureAwait(false);
            //}
        }
Example #9
0
 /// <summary>
 /// Creates the service processor.
 /// </summary>
 /// <returns></returns>
 public IProcessor CreateServiceProcessor()
 {
     CreateInput().CreateHandlerRepository();
     return(ProcessorsFactory.CreateServiceProcessor(_identification, _input, _handlerRepository, ConfigurationMessageBuilder.MessageBuilder));
 }