コード例 #1
0
        public async Task Add_deve_adicionar_usuario()
        {
            //Arrange
            var usuarioViewModel = new UsuarioViewModel()
            {
                Email    = "*****@*****.**",
                Senha    = "1234",
                PessoaId = Guid.NewGuid()
            };

            //Act
            await _usuarioAppService.AddAsync(usuarioViewModel);

            //Assert
            _mocker.GetMock <IMediatorHandler>().Verify(dn =>
                                                        dn.PublishDomainNotification(It.IsAny <DomainNotification>()), Times.Never);
            _mocker.GetMock <IMediatorHandler>().Verify(v =>
                                                        v.SendCommand(It.IsAny <AddUsuarioCommand>()), Times.Once);
        }
コード例 #2
0
        public async Task <IActionResult> Add([FromBody] UsuarioViewModel usuarioViewModel)
        {
            await _appService.AddAsync(usuarioViewModel);

            return(CustomResponse());
        }