示例#1
0
        protected override void LoadAsyncElements()
        {
            var commandDelegate = new CommandDelegate <GetListResponce>(OnSuccess, ShowError, ShowErrorNotEnternet);
            var command         = new GetListCommand(LocalDb.Instance, commandDelegate);

            command.Execute(null);
        }
示例#2
0
        public async Task HandleGetCommand_ShouldCallListServiceGet()
        {
            // Data
            var model = new ListModel {
                Id = Guid.NewGuid(), Name = "Todo list"
            };
            var getListCommand = new GetListCommand {
                Model = model
            };
            IEnumerable <ListModel> modelsList = new List <ListModel>
            {
                model
            };

            // Setup
            _mockListService.Setup(x => x.GetList(model)).Returns(Task.FromResult(modelsList)).Verifiable();
            _mockMessageContext.Setup(x => x.Reply(It.Is <GetResponse>(y => y.Models == modelsList), It.IsAny <ReplyOptions>()))
            .Returns(Task.CompletedTask).Verifiable();

            // Test
            var handler = new ListsEventHandler(_mockListService.Object);
            await handler.Handle(getListCommand, _mockMessageContext.Object);

            // Analysis
            _mockListService.Verify();
            _mockMessageContext.Verify();
        }
示例#3
0
        public async Task <IActionResult> Get([FromBody] ListModel model)
        {
            var user = await _userManagerWrapper.FindByNameAsync(User.Identity.Name);

            model.UserId = user.Id;
            var getlistCommand = new GetListCommand {
                Model = model
            };
            var sendOptions = new SendOptions();

            sendOptions.SetDestination("LifeManager.Lists");
            var response = await _endpointInstance.Request <GetResponse>(getlistCommand, sendOptions).ConfigureAwait(false);

            return(Ok(new { Response = response.Models }));
        }
 public ActionResult GetList([FromQuery] GetListCommand getListCommand)
 {
     return(Ok());
 }
        public async Task Handle(GetListCommand message, IMessageHandlerContext context)
        {
            var lists = await _listService.GetList(message.Model);

            await context.Reply(new GetResponse { Models = lists });
        }