public async void CallsCreatePlan() { // Arrange var paypalRestApiClientMock = new Mock <IPaypalRestApiClient>(); var sut = new BillingPlanApi(paypalRestApiClientMock.Object); var planCreationRequest = new PlanCreateRequest(); string expectedUrl = $"{ExpectedApiUrl}"; // Act await sut.CreatePlanAsync(planCreationRequest); // Assert paypalRestApiClientMock.Verify(x => x.Post <PlanCreateResponse>(planCreationRequest, It.Is <string>(url => url.Equals(expectedUrl, StringComparison.InvariantCultureIgnoreCase)))); }
public async void CallsDeactivatePlan() { // Arrange var paypalRestApiClientMock = new Mock <IPaypalRestApiClient>(); var sut = new BillingPlanApi(paypalRestApiClientMock.Object); string expectedPlanId = "expected-plan-id"; string expectedUrl = $"{ExpectedApiUrl}/{expectedPlanId}/deactivate"; // Act await sut.DeactivatePlan(expectedPlanId); // Assert paypalRestApiClientMock.Verify(x => x.Post(It.Is <string>(url => url.Equals(expectedUrl, StringComparison.InvariantCultureIgnoreCase)))); }
public async void CallsUpdatePricing() { // Arrange var paypalRestApiClientMock = new Mock <IPaypalRestApiClient>(); var sut = new BillingPlanApi(paypalRestApiClientMock.Object); string expectedPlanId = "expected-plan-id"; var expectedPricingUpdateRequest = new PlanUpdatePricingRequest(); string expectedUrl = $"{ExpectedApiUrl}/{expectedPlanId}/update-pricing-schemes"; // Act await sut.UpdatePricingAsync(expectedPlanId, expectedPricingUpdateRequest); // Assert paypalRestApiClientMock.Verify(x => x.Post(expectedPricingUpdateRequest, It.Is <string>(url => url.Equals(expectedUrl, StringComparison.InvariantCultureIgnoreCase)))); }
public async void CallsListPlans() { // Arrange var paypalRestApiClientMock = new Mock <IPaypalRestApiClient>(); var expectedResult = new PlanListResponse(); paypalRestApiClientMock .Setup(x => x.Get <PlanListResponse>(It.IsAny <string>())) .Returns(Task.FromResult(expectedResult)); var sut = new BillingPlanApi(paypalRestApiClientMock.Object); string expectedUrl = $"{ExpectedApiUrl}"; // Act PlanListResponse result = await sut.ListPlansAsync(); // Assert paypalRestApiClientMock.Verify(x => x.Get <PlanListResponse>(It.Is <string>(url => url.Equals(expectedUrl, StringComparison.InvariantCultureIgnoreCase)))); Assert.Equal(expectedResult, result); }