示例#1
0
        public void Conta_Controller_Get_BuscarTodas_Sucesso()
        {
            Conta conta = ObjectMother.ObterContaValida();

            conta.Id = 1;
            IQueryable <Conta> response = new List <Conta>()
            {
                conta
            }.AsQueryable();

            _contaServicoMock.Setup(s => s.BuscarTodos()).Returns(response);

            IHttpActionResult callback = _contasController.BuscarTodos();


            _contaServicoMock.Verify(s => s.BuscarTodos(), Times.Once);
            var httpResponse = callback.Should().BeOfType <OkNegotiatedContentResult <List <Conta> > >().Subject;

            httpResponse.Content.Should().NotBeNullOrEmpty();
            httpResponse.Content.First().Id.Should().Be(conta.Id);
        }