Example #1
0
            public void ShouldSetTheCurrencyCodeTypeToPHP()
            {
                var model = PayPalDGModel.Create()
                            .WithCurrencyCode(CurrencyCodeType.PHP);

                Assert.AreEqual(CurrencyCodeType.PHP, model.CurrencyCodeType);
            }
Example #2
0
            public void ShouldSetTheTaxTotalAmountTo15()
            {
                var model = PayPalDGModel.Create()
                            .WithTaxTotalAmountOf(15);

                Assert.AreEqual(15, model.TaxTotalAmount);
            }
Example #3
0
            public void ShouldBeAbleToSetToFalse()
            {
                var model = PayPalDGModel.Create()
                            .IncludeSupportForCreditCardPayment(false);

                Assert.IsFalse(model.SupportCreditCardPayment);
            }
Example #4
0
            public void WithOneParameter()
            {
                var model = PayPalDGModel.Create()
                            .WithAdditionalCallbackParams(new List <PayPalDGAdditionalCallbackParam>
                {
                    new PayPalDGAdditionalCallbackParam {
                        Name = "p1", Value = "v1"
                    }
                });

                Assert.AreEqual("?p1=v1", model.BuildAdditionalCallbackParams());
            }
Example #5
0
            public void ShouldReturnTheTotalItemAmount()
            {
                var model = PayPalDGModel.Create()
                            .WithProductItems(new List <PayPalDGProductItem>
                {
                    new PayPalDGProductItem {
                        Amount = 15.22m
                    },
                    new PayPalDGProductItem {
                        Amount = 11.01m
                    }
                });

                Assert.AreEqual(26.23m, model.GetItemTotalAmount());
            }
Example #6
0
 public void ShouldThrowPayPalDGExceptionWhenPassing0Item()
 {
     PayPalDGModel.Create().WithProductItems(new List <PayPalDGProductItem>());
 }
Example #7
0
 public void ShouldThrowPayPalDGExceptionWhenPassingNullItems()
 {
     PayPalDGModel.Create().WithProductItems(null);
 }
Example #8
0
            public void ShouldSetTheCallbackUrl()
            {
                var model = PayPalDGModel.Create().WithCancelCallbackUrl("http://localhost:1234/test");

                Assert.AreEqual("http://localhost:1234/test", model.CancelCallbackUrl);
            }
Example #9
0
 public void ShouldThrowPayPalDGExceptionWhenPassingInvalidUrl()
 {
     PayPalDGModel.Create().WithCancelCallbackUrl("/test/url");
 }
Example #10
0
            public void ShouldSetTheSupportForCreditCardPaymentToTrue()
            {
                var model = PayPalDGModel.Create();

                Assert.IsTrue(model.SupportCreditCardPayment);
            }
Example #11
0
 public void ShouldThrowPayPalDGExceptionWhenNoCallbackUrlSpecified()
 {
     PayPalDGModel.Create().WithCancelCallbackUrl(null);
 }
Example #12
0
 public void ShouldThrowPayPalDGExceptionWhenPassingInvalidUrl()
 {
     PayPalDGModel.Create().WithDoExpressCheckoutCallbackUrl("/test/url");
 }
Example #13
0
 public void ShouldThrowPayPalDGExceptionWhenNoCallbackUrlSpecified()
 {
     PayPalDGModel.Create().WithDoExpressCheckoutCallbackUrl(null);
 }