Ejemplo n.º 1
0
        public void UpdatePaymentMethodTest()
        {
            string              authorization       = "Basic asdadsa";
            string              customerId          = "123123";
            string              paymentMethodId     = "67568678";
            CreditCard          creditCard          = new CreditCard("4007000000027", DateTime.Now.AddMonths(new Random().Next(99)).ToString("yyyy-MM"), "VISA", "123");
            PaymentInstrument   paymentInstrunment  = new PaymentInstrument(creditCard, null, null, null, false);
            CreatePaymentMethod updatePaymentMethod = new CreatePaymentMethod(null, null, null, paymentInstrunment);

            //string paymentMethodId = "3456";
            mockRestClient.Expects.One.Method(v => v.Execute(new RestRequest())).With(NMock.Is.TypeOf(typeof(RestRequest))).WillReturn(paymentMethodResponse);
            ApiClient apiClient = new ApiClient(mockRestClient.MockObject);

            apiClient.Configuration = null;

            Configuration configuration = new Configuration
            {
                ApiClient      = apiClient,
                Username       = "******",
                Password       = "******",
                AccessToken    = null,
                ApiKey         = null,
                ApiKeyPrefix   = null,
                TempFolderPath = null,
                DateTimeFormat = null,
                Timeout        = 60000,
                UserAgent      = "asdasd"
            };

            instance = new PaymentmethodsApi(configuration);
            var response = instance.UpdatePaymentMethod(customerId, paymentMethodId, updatePaymentMethod, authorization);

            Assert.IsInstanceOf <PaymentMethod>(response, "response is PaymentMethod");
        }
Ejemplo n.º 2
0
        public void GetCustomerPaymentMethodsTest()
        {
            string authorization = "Basic asdadsa";
            string customerId    = "123123";

            mockRestClient.Expects.One.Method(v => v.Execute(new RestRequest())).With(NMock.Is.TypeOf(typeof(RestRequest))).WillReturn(paymentMethodCollectionResponse);
            ApiClient apiClient = new ApiClient(mockRestClient.MockObject);

            apiClient.Configuration = null;

            Configuration configuration = new Configuration
            {
                ApiClient      = apiClient,
                Username       = "******",
                Password       = "******",
                AccessToken    = null,
                ApiKey         = null,
                ApiKeyPrefix   = null,
                TempFolderPath = null,
                DateTimeFormat = null,
                Timeout        = 60000,
                UserAgent      = "asdasd"
            };

            instance = new PaymentmethodsApi(configuration);

            var response = instance.GetCustomerPaymentMethods(authorization, customerId);

            Assert.IsInstanceOf <PaymentMethodCollection>(response, "response is PaymentMethod");
        }
 public void Init()
 {
     instance = new PaymentmethodsApi();
 }