public void SerializeTest() { KondutoDevice device = KondutoDeviceFactory.Create(); String deviceJSON = KondutoUtils.LoadJson <KondutoDevice>(Properties.Resources.device).ToJson(); try { Assert.AreEqual(deviceJSON, device.ToJson(), "serialization failed"); } catch (KondutoInvalidEntityException e) { Assert.Fail("device should be valid"); } Assert.AreEqual(KondutoModel.FromJson <KondutoDevice>(deviceJSON), device, "deserialization failed"); }
public void SerializationTest() { KondutoOrder order = KondutoOrderFactory.completeOrder(); String orderJSON = KondutoUtils.LoadJson <KondutoOrder>(Properties.Resources.order).ToJson(); try { Assert.AreEqual(orderJSON, order.ToJson(), "serialization failed"); } catch (KondutoInvalidEntityException e) { Assert.Fail("order should be valid"); } KondutoOrder deserializedOrder = KondutoModel.FromJson <KondutoOrder>(orderJSON); Assert.IsTrue(order.Equals(deserializedOrder), "deserialization failed"); }
public void SerializationTest() { KondutoCustomer customer = KondutoCustomerFactory.CompleteCustomer(); String customerJSON = KondutoUtils.LoadJson <KondutoCustomer>(Properties.Resources.customer).ToJson(); try { var v = customer.ToJson(); Assert.AreEqual(customerJSON, customer.ToJson(), "serialization failed"); } catch (KondutoInvalidEntityException e) { Debug.WriteLine(e.Message); } KondutoCustomer deserializedCustomer = KondutoModel.FromJson <KondutoCustomer>(customerJSON); Assert.AreEqual(customer, deserializedCustomer, "deserialization failed"); }
public void SerializationTest() { KondutoGeolocation geolocation = KondutoGeolocationFactory.Create(); String geolocationJSON = KondutoUtils.LoadJson <KondutoGeolocation>(Properties.Resources.geolocation).ToJson(); try { Assert.AreEqual(geolocationJSON, geolocation.ToJson(), "serialization failed"); } catch (KondutoInvalidEntityException e) { Assert.Fail("geolocation should be valid"); } KondutoGeolocation geolocationDeserialized = KondutoModel.FromJson <KondutoGeolocation>(geolocationJSON); Assert.AreEqual(geolocation, geolocationDeserialized, "deserialization failed"); }
public void SerializeTest() { String expectedJSON = KondutoUtils.LoadJson <KondutoTravel>(Properties.Resources.flight).ToJson(); String actualJSON = null; KondutoTravel flight = KondutoFlightFactory.CreateFlight(); try { actualJSON = flight.ToJson(); } catch (KondutoInvalidEntityException e) { Assert.Fail("flight should be valid"); } Assert.AreEqual(expectedJSON, actualJSON, "flight serialization failed"); KondutoTravel flightFromJSON = KondutoModel.FromJson <KondutoTravel>(expectedJSON); Assert.AreEqual(flight, flightFromJSON, "flight deserialization failed"); }
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"); }
public void SerializationTest() { KondutoNavigationInfo navigationInfo = KondutoNavigationInfoFactory.Create(); String navigationInfoJSON = KondutoUtils.LoadJson <KondutoNavigationInfo>(Properties.Resources.navigation).ToJson(); try { var c = navigationInfo.ToJson(); Assert.AreEqual(navigationInfoJSON, navigationInfo.ToJson(), "serialization failed"); } catch (KondutoInvalidEntityException e) { Assert.Fail("navigation info should be valid"); } KondutoNavigationInfo navigationInfoDeserialized = KondutoModel.FromJson <KondutoNavigationInfo>(navigationInfoJSON); Assert.AreEqual(navigationInfoDeserialized, navigationInfo, "deserialization failed"); }
public void SerializeTest() { String expectedJSON = KondutoUtils.LoadJson <KondutoAddress>(Properties.Resources.address).ToJson(); String actualJSON = null; KondutoAddress address = KondutoAddressFactory.Create(); try { actualJSON = address.ToJson(); } catch (KondutoInvalidEntityException e) { Assert.Fail("address should be valid"); } Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); KondutoAddress addressFromJSON = KondutoModel.FromJson <KondutoAddress>(expectedJSON); Assert.AreEqual(address, addressFromJSON, "address deserialization failed"); }
public void CreditSerializeTest() { String expectedJSON = KondutoUtils.GetFirstJArrayElement(Properties.Resources.payments); String actualJSON = null; KondutoCreditCardPayment payment = KondutoPaymentFactory.CreateCreditCardPayment(); try { actualJSON = payment.ToJson(); } catch (KondutoInvalidEntityException e) { Assert.Fail("address should be valid"); } Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); KondutoCreditCardPayment paymentFromJSON = KondutoModel.FromJson <KondutoCreditCardPayment>(expectedJSON); Assert.AreEqual(payment, paymentFromJSON, "address deserialization failed"); }