示例#1
0
        public void SerializationTestWithSeller()
        {
            KondutoOrder order = KondutoOrderFactory.completeOrder();

            order.Seller = KondutoSellerFactory.Create();

            try
            {
                order.ToJson();
                //ok
            }
            catch (KondutoInvalidEntityException e)
            {
                Assert.Fail("order should be invalid");
            }
        }
        public void SerializationTest()
        {
            String        expectedJSON = KondutoUtils.LoadJson <KondutoSeller>(Properties.Resources.seller).ToJson();
            String        actualJSON   = null;
            KondutoSeller seller       = KondutoSellerFactory.Create();

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

            Assert.AreEqual(expectedJSON, actualJSON, "seller serialization failed");
            KondutoSeller sellerFromJson = KondutoModel.FromJson <KondutoSeller>(expectedJSON);

            Assert.AreEqual(seller, sellerFromJson, "passenger deserialization failed");
        }