Exemplo n.º 1
0
        public void UpdateCustomer_ValidParameters_Successful()
        {
            //Arrange
            StripeCustomer customer = new StripeCustomer();
            customer.Id = customerId;

            Mock<StripeCustomerService> custCustService = new Mock<StripeCustomerService>(null);
            custCustService.Setup(cust => cust.Update(It.IsAny<string>(), It.IsAny<StripeCustomerUpdateOptions>(), null))
                .Returns(customer);
            stripeAccessor = new StripeAccessorService(subService.Object, charService.Object, custCustService.Object);

            //Act
            string returnedId = stripeAccessor.UpdateCustomer(customerId, "email", "Hal", "Wilkerson");

            //Assert
            Assert.That(returnedId, Is.EqualTo(customerId));
        }
Exemplo n.º 2
0
        public void UpdateCustomer_InvalidParameters_ThrowsStripeException()
        {
            //Arrange
            StripeException exception = new StripeException();
            exception.StripeError = new StripeError();
            exception.StripeError.ErrorType = "invalid_request";

            Mock<StripeCustomerService> custCustService = new Mock<StripeCustomerService>(null);
            custCustService.Setup(cust => cust.Update(It.IsAny<string>(), It.IsAny<StripeCustomerUpdateOptions>(), null))
                .Throws(exception);
            stripeAccessor = new StripeAccessorService(subService.Object, charService.Object, custCustService.Object);

            //Act
            string returnedException = stripeAccessor.UpdateCustomer(customerId, "email", "Hal", "Wilkerson");

            //Assert
            Assert.That(returnedException, Is.EqualTo("invalid_request"));
        }