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 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 Test_2_1_1_RetrieveByAParticularDate() { chargebackRetrievalResponse response = _retrievalRequest.RetrieveByActivityDate(ChargebackUtils.ParseDate("2013-1-1")); Assert.NotNull(response); Assert.AreEqual(11, response.chargebackCase.Length); chargebackApiCase[] cases = response.chargebackCase; Assert.AreEqual("1111111111", cases[0].acquirerReferenceNumber); Assert.AreEqual("2222222222", cases[1].acquirerReferenceNumber); Assert.AreEqual("3333333333", cases[2].acquirerReferenceNumber); Assert.AreEqual("4444444444", cases[3].acquirerReferenceNumber); Assert.AreEqual("5555555550", cases[4].acquirerReferenceNumber); Assert.AreEqual("5555555551", cases[5].acquirerReferenceNumber); Assert.AreEqual("5555555552", cases[6].acquirerReferenceNumber); Assert.AreEqual("6666666660", cases[7].acquirerReferenceNumber); Assert.AreEqual("7777777770", cases[8].acquirerReferenceNumber); Assert.AreEqual("7777777771", cases[9].acquirerReferenceNumber); Assert.AreEqual("7777777772", cases[10].acquirerReferenceNumber); /* Assert.AreEqual("FIRST_CHARGBACK", cases[0].cycle); * Assert.AreEqual("FIRST_CHARGBACK", cases[1].cycle); * Assert.AreEqual("FIRST_CHARGBACK", cases[2].cycle); * Assert.AreEqual("FIRST_CHARGBACK", cases[3].cycle); * Assert.AreEqual("PRE_ARB_CHARGBACK", cases[4].cycle); * Assert.AreEqual("PRE_ARB_CHARGBACK", cases[5].cycle); * Assert.AreEqual("PRE_ARB_CHARGBACK", cases[6].cycle); * Assert.AreEqual("ARBITRATION_CHARGEBACK", cases[7].cycle); * Assert.AreEqual("ISSUER_DECLINE_PRESAB", cases[8].cycle); * Assert.AreEqual("ISSUER_DECLINE_PRESAB", cases[9].cycle); * Assert.AreEqual("ISSUER_DECLINE_PRESAB", cases[10].cycle);*/ }