Example #1
0
        public async Task TestLinkCallsSetDictWhenUnpaidCreditCard()
        {
            // Arrange
            Dictionary <string, string> dictionary = null;

            MockDataSigningService.Setup(a => a.Sign(It.IsAny <Dictionary <string, string> >())).Returns("FakeSign").Callback <Dictionary <string, string> >(c => dictionary = c);
            OrderData[1].Status      = OrderStatusCodes.Finalized;
            OrderData[1].PaymentType = PaymentTypeCodes.CreditCard;
            OrderData[1].Paid        = false;

            // Act
            var controllerResult = await Controller.Link(OrderData[1].ShareIdentifier);

            // Assert
            Assert.IsType <ViewResult>(controllerResult);
            MockDataSigningService.Verify(a => a.Sign(It.IsAny <Dictionary <string, string> >()), Times.Once);
            dictionary.ShouldNotBeNull();
        }
Example #2
0
        public async Task TestLinkCallsSetsDictToExpectedValuesWhenUnpaidCreditCard()
        {
            // Arrange
            Dictionary <string, string> dictionary = null;

            MockDataSigningService.Setup(a => a.Sign(It.IsAny <Dictionary <string, string> >())).Returns("FakeSign").Callback <Dictionary <string, string> >(c => dictionary = c);
            OrderData[1].Status      = OrderStatusCodes.Finalized;
            OrderData[1].PaymentType = PaymentTypeCodes.CreditCard;
            OrderData[1].Paid        = false;
            var od = OrderData[1].GetOrderDetails();

            od.AdjustmentAmount = 2.51m;
            OrderData[1].SaveDetails(od);

            // Act
            var controllerResult = await Controller.Link(OrderData[1].ShareIdentifier);

            // Assert
            Assert.IsType <ViewResult>(controllerResult);
            MockDataSigningService.Verify(a => a.Sign(It.IsAny <Dictionary <string, string> >()), Times.Once);
            dictionary.ShouldNotBeNull();
            dictionary.Count.ShouldBe(16);
            dictionary["transaction_type"].ShouldBe("sale");
            dictionary["reference_number"].ShouldBe("2");
            dictionary["amount"].ShouldBe("2.51");
            dictionary["currency"].ShouldBe("USD");
            dictionary["access_key"].ShouldBe("123");
            dictionary["profile_id"].ShouldBe("myProfile");
            dictionary["transaction_uuid"].ShouldNotBeNull();
            dictionary["signed_date_time"].ShouldNotBeNull();
            dictionary["unsigned_field_names"].ShouldBe(string.Empty);
            dictionary["locale"].ShouldBe("en");
            dictionary["bill_to_email"].ShouldBe("*****@*****.**");
            dictionary["bill_to_forename"].ShouldBe("FirstName2");
            dictionary["bill_to_surname"].ShouldBe("LastName2");
            dictionary["bill_to_address_country"].ShouldBe("US");
            dictionary["bill_to_address_state"].ShouldBe("CA");
            dictionary["signed_field_names"].ShouldBe("signed_field_names,transaction_type,reference_number,amount,currency,access_key,profile_id,transaction_uuid,signed_date_time,unsigned_field_names,locale,bill_to_email,bill_to_forename,bill_to_surname,bill_to_address_country,bill_to_address_state");
        }