public void MPIPN_ShouldBeOk() { SDK.CleanConfiguration(); SDK.SetAccessToken(Environment.GetEnvironmentVariable("ACCESS_TOKEN")); Payment payment = new Payment(); Payer payer = new Payer(); payer.Email = "*****@*****.**"; payment.TransactionAmount = (float)100; payment.Token = GenerateSingleUseCardToken(); // 1 use card token payment.Description = "Pago de seguro"; payment.PaymentMethodId = "visa"; payment.Installments = 1; payment.Payer = payer; payment.Save(); var resource = MPIPN.Manage <Payment>(MPIPN.Topic.payment, payment.Id.ToString()); Assert.IsTrue(resource.GetType().IsSubclassOf(typeof(MPBase))); Assert.AreEqual(payment.Id, ((Payment)resource).Id); Assert.AreEqual(payment.Description, ((Payment)resource).Description); Assert.AreEqual(payment.PaymentMethodId, ((Payment)resource).PaymentMethodId); }
public void MPIPN_MustThrowException_ClassNotExtendsFromMPBase() { try { MPIPN.Manage <Payment>("MercadoPago.DataStructures.Customer.City", "1234567"); } catch (MPException ex) { Assert.AreEqual("City does not extend from MPBase", ex.Message); return; } Assert.Fail(); }
public void MPIPN_MustThrowException_TopicParameterEmpty() { try { MPIPN.Manage <Payment>(null, "id"); } catch (MPException ex) { Assert.AreEqual("Topic and Id can not be null in the IPN request.", ex.Message); return; } Assert.Fail(); }
public void MPIPN_GetTypeShouldReturnATypeObject() { Type type = MPIPN.GetType(MPIPN.Topic.payment); Type castType = type as Type; if (castType != null) { Assert.Pass(); } else { Assert.Fail(); } }
public void MPIPN_GetTypeShouldReturnNotNullValue() { Type type = MPIPN.GetType(MPIPN.Topic.payment); Assert.IsNotNull(type); }
public void MPIPN_GetTypeShouldReturnNull() { Type type = MPIPN.GetType("MercadoPago.Resources.PaymentMeans"); Assert.IsNull(type); }
public void MPIPN_GetTypeShouldFindTheRightClassType() { Type type = MPIPN.GetType(MPIPN.Topic.payment); Assert.IsTrue(typeof(Payment) == type); }