コード例 #1
0
ファイル: Order.cs プロジェクト: olivierpaes/RestaurantKata
        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);
        }
コード例 #2
0
ファイル: Order.cs プロジェクト: njmube/RestaurantKata
        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);
        }