コード例 #1
0
        public async Task Deve_Retornar_Lista_De_Usuarios_Cadastrados()
        {
            //arrange
            var list = new List <UsuarioViewModel>()
            {
                ViewModelBuilder.UsuarioFake(),
                ViewModelBuilder.UsuarioFake(),
                ViewModelBuilder.UsuarioFake(),
            };

            _mediator.Setup(s => s.Send(It.IsAny <IRequest <IEnumerable <UsuarioViewModel> > >(), new System.Threading.CancellationToken()))
            .ReturnsAsync(list).Verifiable();
            //act
            var result = await _controller.GetUsuariosAsync();

            //assert
            result.Should().BeAssignableTo <OkObjectResult>();
            var vr = result as OkObjectResult;

            vr.Value.Should().Be(list);
            vr.StatusCode.Should().Be(StatusCodes.Status200OK);
            _mediator.Verify();
        }
コード例 #2
0
 private async void cargarDatos()
 {
     dgvDatos.DataSource = await _controller.GetUsuariosAsync();
 }