public void TestePagarContaMockContaPagarService() { var mockService = new Mock<IContaPagarService>(); mockService.Setup(x => x.PagarContas(new List<ContaPagar>())); var controller = new ContaPagarController(mockService.Object) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; var response = controller.PagarConta(new List<ContaPagarModel>()); var data = response.Result.Content.ReadAsAsync<RetornoBase<object>>(); Assert.AreEqual(HttpStatusCode.OK, response.Result.StatusCode); Assert.AreEqual(null, data.Result.ObjetoRetorno); Assert.AreEqual(false, data.Result.TemErros); Assert.AreEqual(Mensagens.ReturnSuccess, data.Result.Mensagem); }
private static ContaPagarController CreateContaPagarController(IMock<IContaPagarRepository> mockContaPagarRepository) { var contaPagarService = new ContaPagarService(mockContaPagarRepository.Object); var controller = new ContaPagarController(contaPagarService) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; return controller; }