public void testUpdateSubscription_CanContainUpdateAddOns() { var update = new UpdateSubscription { SubscriptionId = 1, UpdateAddOns = { new UpdateAddOn { AddOnCode = "1", Name = "addOn1", Amount = 100, StartDate = new DateTime(2013, 9, 5), EndDate = new DateTime(2013, 9, 6) }, new UpdateAddOn { AddOnCode = "2", Name = "addOn2", Amount = 200, StartDate = new DateTime(2013, 9, 4), EndDate = new DateTime(2013, 9, 5) } } }; string actual = update.Serialize(); const string expected = @" <updateSubscription> <subscriptionId>1</subscriptionId> <updateAddOn> <addOnCode>1</addOnCode> <name>addOn1</name> <amount>100</amount> <startDate>2013-09-05</startDate> <endDate>2013-09-06</endDate> </updateAddOn> <updateAddOn> <addOnCode>2</addOnCode> <name>addOn2</name> <amount>200</amount> <startDate>2013-09-04</startDate> <endDate>2013-09-05</endDate> </updateAddOn> </updateSubscription>"; Assert.AreEqual(expected, actual); }
public void testUpdateSubscription_CanContainPaypage() { var update = new UpdateSubscription { SubscriptionId = 1, Paypage = new CardPaypageType {PaypageRegistrationId = "abc123"} }; string actual = update.Serialize(); const string expected = @" <updateSubscription> <subscriptionId>1</subscriptionId> <paypage> <paypageRegistrationId>abc123</paypageRegistrationId> </paypage> </updateSubscription>"; Assert.AreEqual(expected, actual); }
public void testUpdateSubscription_CanContainToken() { var update = new UpdateSubscription { SubscriptionId = 1, Token = new CardTokenType {LitleToken = "123456"} }; string actual = update.Serialize(); const string expected = @" <updateSubscription> <subscriptionId>1</subscriptionId> <token> <litleToken>123456</litleToken> </token> </updateSubscription>"; Assert.AreEqual(expected, actual); }
public void testUpdateSubscription_CanContainDeleteDiscounts() { var update = new UpdateSubscription { SubscriptionId = 1, DeleteDiscounts = { new DeleteDiscount {DiscountCode = "1"}, new DeleteDiscount {DiscountCode = "2"} } }; string actual = update.Serialize(); const string expected = @" <updateSubscription> <subscriptionId>1</subscriptionId> <deleteDiscount> <discountCode>1</discountCode> </deleteDiscount> <deleteDiscount> <discountCode>2</discountCode> </deleteDiscount> </updateSubscription>"; Assert.AreEqual(expected, actual); }
public void testUpdateSubscription_CanContainCreateDiscounts() { var update = new UpdateSubscription { SubscriptionId = 1, CreateDiscounts = { new CreateDiscount { DiscountCode = "1", Name = "cheaper", Amount = 200, StartDate = new DateTime(2013, 9, 5), EndDate = new DateTime(2013, 9, 6) }, new CreateDiscount { DiscountCode = "2", Name = "cheap", Amount = 100, StartDate = new DateTime(2013, 9, 3), EndDate = new DateTime(2013, 9, 4) } } }; string actual = update.Serialize(); const string expected = @" <updateSubscription> <subscriptionId>1</subscriptionId> <createDiscount> <discountCode>1</discountCode> <name>cheaper</name> <amount>200</amount> <startDate>2013-09-05</startDate> <endDate>2013-09-06</endDate> </createDiscount> <createDiscount> <discountCode>2</discountCode> <name>cheap</name> <amount>100</amount> <startDate>2013-09-03</startDate> <endDate>2013-09-04</endDate> </createDiscount> </updateSubscription>"; Assert.AreEqual(expected, actual); }
public void testUpdateSubscription_OnlyRequired() { var update = new UpdateSubscription { SubscriptionId = 12345 }; string actual = update.Serialize(); const string expected = "\r\n<updateSubscription>\r\n<subscriptionId>12345</subscriptionId>\r\n</updateSubscription>"; Assert.AreEqual(expected, actual); }
public void TestUpdateSubscription_Full() { var update = new UpdateSubscription { BillingDate = new DateTime(2002, 10, 9), BillToAddress = new Contact { Name = "Greg Dake", City = "Lowell", State = "MA", Email = "*****@*****.**" }, Card = new CardType { Number = "4100000000000001", ExpDate = "1215", Type = MethodOfPaymentTypeEnum.VI }, PlanCode = "abcdefg", SubscriptionId = 12345 }; string actual = update.Serialize(); const string expected = "\r\n<updateSubscription>\r\n<subscriptionId>12345</subscriptionId>\r\n<planCode>abcdefg</planCode>\r\n<billToAddress>\r\n<name>Greg Dake</name>\r\n<city>Lowell</city>\r\n<state>MA</state>\r\n<email>[email protected]</email>\r\n</billToAddress>\r\n<card>\r\n<type>VI</type>\r\n<number>4100000000000001</number>\r\n<expDate>1215</expDate>\r\n</card>\r\n<billingDate>2002-10-09</billingDate>\r\n</updateSubscription>"; Assert.AreEqual(expected, actual); }
public void testUpdateSubscription() { UpdateSubscription update = new UpdateSubscription(); update.BillingDate = new DateTime(2002, 10, 9); Contact billToAddress = new Contact(); billToAddress.Name = "Greg Dake"; billToAddress.City = "Lowell"; billToAddress.State = "MA"; billToAddress.Email = "*****@*****.**"; update.BillToAddress = billToAddress; CardType card = new CardType(); card.Number = "4100000000000001"; card.ExpDate = "1215"; card.Type = MethodOfPaymentTypeEnum.VI; update.Card = card; update.PlanCode = "abcdefg"; update.SubscriptionId = 12345; batchRequest.AddUpdateSubscription(update); Assert.AreEqual(1, batchRequest.GetNumUpdateSubscriptions()); mockLitleFile.Verify(litleFile => litleFile.CreateRandomFile(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<String>(), mockLitleTime.Object)); mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, update.Serialize())); }