public void All_ReturnPlansWithAddOnsAndDiscounts()
{
string planToken = string.Format("plan{0}", new Random().Next(1000000).ToString());
service.Post(service.MerchantPath() + "/plans/create_plan_for_tests", new PlanRequestForTests {
BillingDayOfMonth = 1,
BillingFrequency = 1,
CurrencyIsoCode = "USD",
Description = "a_test_plan",
Id = planToken,
Name = "dotnet_plan",
NumberOfBillingCycles = 1,
Price = 100.00M,
TrialPeriod = false,
});
service.Post(service.MerchantPath() + "/modifications/create_modification_for_tests", new ModificationRequestForTests {
Amount = 1,
Kind = "add_on",
Name = "dotnet_test_modification_add_on",
PlanId = planToken
});
service.Post(service.MerchantPath() + "/modifications/create_modification_for_tests", new ModificationRequestForTests {
Amount = 1,
Kind = "discount",
Name = "dotnet_test_modification_discount",
PlanId = planToken
});
List<Plan> collection = gateway.Plan.All();
Assert.IsNotEmpty(collection);
Plan plan = collection.Find
(
delegate(Plan p)
{
return p.Id == planToken;
}
);
Assert.AreEqual("dotnet_plan", plan.Name);
Assert.AreEqual("dotnet_test_modification_add_on", plan.AddOns[0].Name);
Assert.AreEqual("dotnet_test_modification_discount", plan.Discounts[0].Name);
}
}