public void TestRetrieveByArn()
        {
            var retrievalResponse = _retrievalRequest.RetrieveByArn(5555555551.ToString());

            Assert.NotNull(retrievalResponse);
            Assert.NotNull(retrievalResponse.transactionId);
            Assert.NotNull(retrievalResponse.chargebackCase);
        }
Exemplo n.º 2
0
        public void TestRetrieveByArn(string arn, 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(string.Format("/chargebacks/?arn={0}", arn)))
            .Returns(expectedResponseContent);
            var request
                = new ChargebackRetrievalRequest(commMock.Object);
            var response
                = request.RetrieveByArn(arn);

            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_2_AddNote()
        {
            // Step 1. Perform a new activity for the case retrieved from ARN 1111111111.
            chargebackRetrievalResponse retrievalResponse = _retrievalRequest.RetrieveByArn("1111111111");
            long caseId = retrievalResponse.chargebackCase[0].caseId;

            long   milSec       = DateTime.Now.Millisecond;
            string expectedNote = milSec + " Call Vantiv!";
            chargebackUpdateResponse updateResponse = _updateRequest.AddNote(caseId, expectedNote);

            Assert.NotNull(updateResponse);

            // Step 2. Verify that the new activity has been appended to the activity list for the case.
            retrievalResponse = _retrievalRequest.RetrieveByArn("1111111111");
            chargebackApiActivity[] activities = retrievalResponse.chargebackCase[0].activity;
            foreach (var activity in activities)
            {
                if (expectedNote.Equals(activity.notes))
                {
                    Assert.AreEqual("Add Note", activity.activityType);
                    Assert.Pass();
                }
            }
            Assert.Fail();
        }