Esempio n. 1
0
        public void DataObject_DoesNotSerializeBooleansByDefault()
        {
            var ot = new SimpleDataObject()
            {
                BooleanValue = true
            };
            var dt = ot.ToDictionary();

            Assert.IsFalse(dt.ContainsKey("BooleanValue"));
        }
Esempio n. 2
0
        public void DataObject_CanSerializeDoubles()
        {
            var o = new SimpleDataObject()
            {
                DoubleValue = 3.2
            };
            var d = o.ToDictionary();

            Assert.AreEqual("3.2", d["DoubleValue"]);
        }
Esempio n. 3
0
        public void DataObject_CanSerializeInt32s()
        {
            var o = new SimpleDataObject()
            {
                Int32Value = 32
            };
            var d = o.ToDictionary();

            Assert.AreEqual("32", d["Int32Value"]);
        }
Esempio n. 4
0
        public void DataObject_CanSerializeStrings()
        {
            var o = new SimpleDataObject()
            {
                StringValue = "a string"
            };
            var d = o.ToDictionary();

            Assert.AreEqual("a string", d["StringValue"]);
        }
Esempio n. 5
0
        public static void AssertFullMatch(SimpleDataObject a, SimpleDataObject b)
        {
            var dict_a = a.ToDictionary();
            var dict_b = b.ToDictionary();

            Assert.AreEqual(dict_a.Count, dict_b.Count);
            foreach (var k in dict_a.Keys)
            {
                Assert.AreEqual(dict_a[k], dict_b[k]);
            }
        }
Esempio n. 6
0
        public void DataObject_CanSerializeGuids()
        {
            var guidstring = "CA37A611-B7F4-4EE8-AE2F-D32FB2D0D151";
            var guid       = new Guid(guidstring);

            var o = new SimpleDataObject()
            {
                GuidValue = guid
            };
            var d = o.ToDictionary();

            Assert.AreEqual(guidstring.ToLower(), d["GuidValue"]);
        }
Esempio n. 7
0
        public void DataObject_CanSerializeBooleans()
        {
            var ot = new SimpleDataObject()
            {
                BooleanValue = true
            };
            var dt = ot.ToDictionary(true);

            Assert.AreEqual("1", dt["BooleanValue"]);

            var of = new SimpleDataObject()
            {
                BooleanValue = false
            };
            var df = of.ToDictionary(true);

            Assert.AreEqual("0", df["BooleanValue"]);
        }