Exemplo n.º 1
0
        public void TestGiftCardCreditTxnId()
        {
            giftCardCredit credit = new giftCardCredit();

            credit.id           = "1";
            credit.reportGroup  = "planets";
            credit.litleTxnId   = 123456000;
            credit.creditAmount = 106;
            giftCardCardType card = new giftCardCardType();

            card.type    = methodOfPaymentTypeEnum.GC;
            card.number  = "4100000000000000";
            card.expDate = "1210";
            credit.card  = card;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<litleTxnId>123456000</litleTxnId>\r\n<creditAmount>106</creditAmount>\r\n<card>\r\n<type>GC</type>\r\n<number>4100000000000000</number>\r\n<expDate>1210</expDate>\r.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><creditResponse><litleTxnId>123</litleTxnId></creditResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.GiftCardCredit(credit);
        }
        public void TestGiftCardCreditWithTxnId()
        {
            var creditObj = new giftCardCredit
            {
                id           = "1",
                reportGroup  = "planets",
                litleTxnId   = 123456000,
                creditAmount = 106,
                card         = new giftCardCardType
                {
                    type    = methodOfPaymentTypeEnum.GC,
                    number  = "4100000000000000",
                    expDate = "1210"
                }
            };

            var response = _litle.GiftCardCredit(creditObj);

            Assert.AreEqual("Approved", response.message);
        }