Ejemplo n.º 1
0
        public void ChargeCustomer_InvalidParameters_ThrowsException()
        {
            //Arrange
            Exception exception = new Exception();

            Mock<StripeChargeService> custChargeService = new Mock<StripeChargeService>(null);
            custChargeService.Setup(charg => charg.Create(It.IsAny<StripeChargeCreateOptions>(), null))
                .Throws(exception);
            stripeAccessor = new StripeAccessorService(subService.Object, custChargeService.Object, cusService.Object);

            //Act
            //Act
            String returnedException = stripeAccessor.ChargeCustomer(customerId, 2, 15, 2016, 1, 25);

            //Assert
            Assert.That(returnedException, Is.Null);
        }
Ejemplo n.º 2
0
        public void ChargeCustomer_ValidParameters_Successful()
        {
            //Arrange
            StripeCharge charge = new StripeCharge();
            charge.Id = chargeId;

            Mock<StripeChargeService> custChargeService = new Mock<StripeChargeService>(null);
            custChargeService.Setup(charg => charg.Create(It.IsAny<StripeChargeCreateOptions>(), null))
                .Returns(charge);
            stripeAccessor = new StripeAccessorService(subService.Object, custChargeService.Object, cusService.Object);

            //Act
            String returnedId = stripeAccessor.ChargeCustomer(customerId, 2, 15, 2016, 1, 25);

            //Assert
            Assert.That(returnedId, Is.EqualTo(chargeId));
        }