示例#1
0
        public async Task <OperationResponse> TestIRequset(string str)
        {
            await Task.CompletedTask;

            var result = await _mediatorbus.SendAsync(new TestEnevtRequest()
            {
                Test = "1as3d13asd13as"
            });

            return(new OperationResponse());
        }
示例#2
0
        public async Task AddUserCommandHandler_UserAlreadyExists_AndHasCHanges_ShouldReturn_UserId()
        {
            var guid    = Guid.NewGuid();
            var user    = new UserBuild().Builder();
            var command = new AddUserCommandBuilder().Builder();

            repositoryMock.GetByExternalIdAsync(Arg.Any <string>()).Returns(user);
            mediatorHandlerMock.SendAsync(Arg.Any <UpdateUserCommand>()).Returns(new CommandResult(true, guid));
            var result = await handler.Handle(command, new CancellationToken());

            Assert.True(result.Success);
            Assert.AreEqual(guid, (Guid)result.Data);
        }
        public override async Task <UsuarioResponse> AdicionarUsuario(AdicionarUsuarioRequest request, ServerCallContext context)
        {
            var command = adicionarUsuarioCommandMapping.Mapper(request);

            return(usuarioCommandResultMapping.Mapper(await mediator.SendAsync(command)));
        }
示例#4
0
 protected async Task <CommandResult> SendCommand <TCommand>(Command <TCommand> command) where TCommand : Command <TCommand>
 => await mediator.SendAsync(command);
示例#5
0
 protected async Task <CommandResult> SendCommandAsync(Command command) => await mediator.SendAsync(command);