private Plan CreatePlan(Plan plan) { var plan1 = api.CreatePlan(plan); Assert.That(plan1.status, Is.EqualTo(SubscriptionStatus.Active)); return plan1; }
public void CreateSubscription() { string testPlanID = "TestPlanForUnitTest"; bool planExists = false; try { var plan = api.GetPlan(testPlanID); planExists = true; } catch (NetellerException ex) { if (!ex.Message.Contains("NotFound")) throw; Console.WriteLine("Plan already exist"); } if (!planExists) { Console.WriteLine("Creating plan"); var plan = new Plan() { planId = testPlanID, planName = "Test plan for Unit Test.", interval = 1, intervalType = IntervalType.Weekly, intervalCount = 1, amount = 100, currency = "EUR" }; plan = CreatePlan(plan); Assert.That(plan.status, Is.EqualTo(SubscriptionStatus.Active)); } //FIXME: create payment to a subscription //no way to create this non-interactively at the moment :( //Console.WriteLine("Creating subscription"); //NewSubscription newSub = new NewSubscription() //{ // accountProfile = new AccountProfileLite() { email = "TEST" }, // planId = testPlanID, // startDate = string.Empty //leave empty (not null) to start immediately! //}; //api.CreateSubscription(newSub, accessToken); }
public void CreateSubscriptionPlanThenDelete() { string testPlanID = "TestPlanForUnitTestDeleteMe"; var plan = new Plan() { planId = testPlanID, planName = "Test plan for Unit Test. Should be deleted.", interval = 1, intervalType = IntervalType.Weekly, intervalCount = 1, amount = 100, currency = "EUR" }; var plan1 = CreatePlan(plan); Assert.That(plan1.planId, Is.EqualTo(testPlanID)); var plan2 = api.GetPlan(testPlanID); Assert.That(plan1.planId, Is.EqualTo(plan2.planId)); DeletePlan(testPlanID); }