Ejemplo n.º 1
0
        public void DocumentIsPreserved()
        {
            var order = new WaitressOrder
            {
                TableNumber = 15,
                Server      = "Mike",
            };

            var serializedWaitressOrder = JsonConvert.SerializeObject(order);

            dynamic deserializedWaitressOrder = JObject.Parse(serializedWaitressOrder);

            Assert.That(deserializedWaitressOrder.TableNumber.ToString(), Is.EqualTo("15"));

            var cook = new CookOrder(deserializedWaitressOrder);

            cook.TableNumber = "999";
            cook.OriginalDocument.AnotherProperty = 15M;
            var reserialized = JsonConvert.SerializeObject(cook.OriginalDocument);
        }
Ejemplo n.º 2
0
        public void DocumentIsPreserved()
        {
            var order = new WaitressOrder
                            {
                                TableNumber = 15,
                                Server = "Mike",
                            };

            var serializedWaitressOrder = JsonConvert.SerializeObject(order);

            dynamic deserializedWaitressOrder = JObject.Parse(serializedWaitressOrder);
            Assert.That(deserializedWaitressOrder.TableNumber.ToString(), Is.EqualTo("15"));

            var cook = new CookOrder(deserializedWaitressOrder);
            cook.TableNumber = "999";
            cook.OriginalDocument.AnotherProperty = 15M;
            var reserialized = JsonConvert.SerializeObject(cook.OriginalDocument);
        }