public void TestRetrieveByCardNumber(string cardNumber, string expirationDate, int expectedId, int expectedNCases, bool expectedNull) { var expectedXmlResponse = GenerateXmlResponse(expectedId, expectedNCases); var expectedResponseContent = new ResponseContent( "text/xml", ChargebackUtils.StringToBytes(expectedXmlResponse)); var commMock = new Mock <Communication>(); var cardExpirationdate = ChargebackUtils.ParseDate(expirationDate); var stringCardExpirationdate = cardExpirationdate.ToString("MMyy"); string expectedQuery = string.Format("/chargebacks/?cardNumber={0}&expirationDate={1}", cardNumber, stringCardExpirationdate); commMock.Setup(c => c.Get(expectedQuery)) .Returns(expectedResponseContent); var request = new ChargebackRetrievalRequest(commMock.Object); var response = request.RetrieveByCardNumber(cardNumber, cardExpirationdate.Month, cardExpirationdate.Year); Assert.AreEqual(expectedId, response.transactionId); var nullCase = response.chargebackCase == null; Assert.AreEqual(expectedNull, nullCase); if (!nullCase) { Assert.AreEqual(expectedNCases, response.chargebackCase.Length); } }
public void SetUp() { var config = new Configuration(); config.Set("host", "https://services.vantivprelive.com"); _retrievalRequest = new ChargebackRetrievalRequest { Config = config }; _updateRequest = new ChargebackUpdateRequest { Config = config }; }
public void TestRetrieveByActivityDate(string date, int expectedId, int expectedNCases, bool expectedNull) { var expectedXmlResponse = GenerateXmlResponse(expectedId, expectedNCases); var expectedResponseContent = new ResponseContent( "text/xml", ChargebackUtils.StringToBytes(expectedXmlResponse)); var commMock = new Mock <Communication>(); commMock.Setup(c => c.Get("/chargebacks/?date=" + date)) .Returns(expectedResponseContent); var request = new ChargebackRetrievalRequest(commMock.Object); var response = request.RetrieveByActivityDate(ChargebackUtils.ParseDate(date)); Assert.AreEqual(expectedId, response.transactionId); var nullCase = response.chargebackCase == null; Assert.AreEqual(expectedNull, nullCase); if (!nullCase) { Assert.AreEqual(expectedNCases, response.chargebackCase.Length); } }
public void SetUp() { _retrievalRequest = new ChargebackRetrievalRequest(); }