コード例 #1
0
        public void Conta_Controller_PegarTodos_Deve_Funcionar()
        {
            int?limite   = null;
            var conta    = ObjectMother.ObtemContaValida();
            var response = new List <Conta>()
            {
                conta
            }.AsQueryable();

            _contaServicoMock.Setup(s => s.PegarTodos(limite)).Returns(response);

            var callback = _contasController.PegarTodos();

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

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