コード例 #1
0
ファイル: StripeServiceTest.cs プロジェクト: mimusys/Nigmys
        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));
        }
コード例 #2
0
ファイル: StripeServiceTest.cs プロジェクト: mimusys/Nigmys
        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"));
        }