Пример #1
0
        public void BoletoSerializeTest()
        {
            JArray a                     = JArray.Parse(Properties.Resources.payments);
            String expectedJSON          = a.Last.ToString();
            String actualJSON            = null;
            KondutoBoletoPayment payment = KondutoPaymentFactory.CreateBoletoPayment();

            try
            {
                actualJSON = payment.ToJson();
            }
            catch (KondutoInvalidEntityException e)
            {
                Assert.Fail("payment should be valid");
            }

            Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed");

            KondutoBoletoPayment paymentFromJSON = KondutoModel.FromJson <KondutoBoletoPayment>(expectedJSON);

            Assert.AreEqual(payment, paymentFromJSON, "payment deserialization failed");
        }