public void GetPagamentoServicoTest()
        {
            var client = Substitute.For <IHttpHandler>();
            var pagamentoServiceFactory = new PagamentoServiceFactory(SetupTests.GetPaymentSettings(), client);

            var service = pagamentoServiceFactory.GetPagamentoServico(ETipoPagamento.CARTAO);

            Assert.NotNull(service);
            Assert.IsAssignableFrom <IPagamentoServico>(service);
        }
Esempio n. 2
0
        public async Task RequisitaPagamentoTest()
        {
            var pagamento         = SetupTests.GetPagamento();
            var client            = Substitute.For <IHttpHandler>();
            var pgtoCartaoServico = new PagamentoCartaoServico(SetupTests.GetPaymentSettings(), client);


            var request     = JsonSerializer.Serialize(pagamento.ToPagamentoCreate());
            var httpContent = new StringContent(request, Encoding.UTF8, "application/json");
            var response    = new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK, Content = httpContent
            };

            client.PostAsync(Arg.Any <string>(), Arg.Any <HttpContent>()).Returns(response);

            var result = await pgtoCartaoServico.RequisitaPagamento(pagamento);

            Assert.NotNull(pagamento);
        }