コード例 #1
0
        public void Conta_Controller_PegarPorId_DeveFuncionar()
        {
            var id = 1;

            _conta.Setup(p => p.Id).Returns(id);
            _contaServicoMock.Setup(c => c.PegarPorId(id)).Returns(_conta.Object);

            IHttpActionResult callback = _contasController.PegarPorId(id);

            var httpResponse = callback.Should().BeOfType <OkNegotiatedContentResult <Conta> >().Subject;

            httpResponse.Content.Should().NotBeNull();
            httpResponse.Content.Id.Should().Be(id);
            _contaServicoMock.Verify(s => s.PegarPorId(id), Times.Once);
            _conta.Verify(p => p.Id, Times.Once);
        }