Ejemplo n.º 1
0
        public void ShouldReturnErrorMessageWhenPassingNullRequest()
        {
            //Arrange
            SearchPaymentTransaction searchPaymentTransaction = new SearchPaymentTransaction(null, null, logger);
            //Act
            BaseResponse response = searchPaymentTransaction.Execute(null);

            //Assert
            Assert.AreEqual("Ocorreu um erro na chamada da transação de busca de pagamento. Verifique o log de erro para mais detalhes", response.ReturnMessage);
        }
Ejemplo n.º 2
0
        public void ShouldNotCallParseRequestToMessageForSearchPaymentTransaction()
        {
            //Arrange
            //Mock Formatter
            var formatterMock = new Mock <IFormatter <PaymentRequest, BaseResponse, string> >();

            formatterMock.Setup(f => f.ParseRequestToMessage(It.IsAny <PaymentRequest>()));
            //Mock Service
            var serviceMock = new Mock <HttpServiceBase <PaymentRequest, HttpResponseMessage> >(MockBehavior.Strict, new Credential(), "urlFake");

            serviceMock.Setup(s => s.Execute(It.IsAny <PaymentRequest>())).Returns(new HttpResponseMessage()
            {
                Content = new StringContent("teste"), StatusCode = System.Net.HttpStatusCode.OK
            });
            SearchPaymentTransaction searchPaymentTransaction = new SearchPaymentTransaction(formatterMock.Object, serviceMock.Object, logger);

            //Act
            searchPaymentTransaction.Execute(new PaymentRequest());
            //Assert
            formatterMock.Verify(f => f.ParseRequestToMessage(It.IsAny <PaymentRequest>()), Times.Never);
        }