예제 #1
0
        public void ItCanMapFromCyanEntity()
        {
            // g
            const string valueString = "something";
            var aTimestamp = DateTime.Now;
            var ce = new CyanEntity {ETag = valueString, Timestamp = aTimestamp};
            ce.Fields.Add("id", valueString);
            ce.Fields.Add("name", valueString);

            var expected = JsonObjectFactory.CreateJsonObject(aTimestamp);

            // w
            var json = ce.ToJsonObject();

            // t
            json.ShouldBeEquivalentTo(expected);
        }
예제 #2
0
        public void ItShouldInflateArrays()
        {
            // g
            var expected = new object[] {"1", "2", "3"};
            var expectedString = JsonConvert.SerializeObject(expected);

            var ce = new CyanEntity();
            ce.Fields.Add("dragon_ids", expectedString);

            // w
            var json = ce.ToJsonObject();

            // t
            json["dragon_ids"].ShouldBeEquivalentTo(expected);
        }