Beispiel #1
0
        public void ThrowsOnDuplicateName()
        {
            DataPropertyCollection propList = new DataPropertyCollection();

            propList.Add("Name", "some value");
            Expect.Throws(() =>
            {
                propList.Add("Name", "bad bad");
            },
                          (ex) =>
            {
                OutLineFormat("{0}", ConsoleColor.Yellow, ex.Message);
            }, "Should have thrown exception");
        }
Beispiel #2
0
        public void CanSerializeAndDeserializeDataPropertyList()
        {
            DataPropertyCollection propList = new DataPropertyCollection();

            propList.Add("Prop1", true);
            propList.Add("Prop2", false);
            propList.Add("Name", "Banana");
            byte[] serialized = propList.ToBinaryBytes();

            DataPropertyCollection deserialized = serialized.FromBinaryBytes <DataPropertyCollection>();

            Expect.AreEqual(3, deserialized.Count);
            Expect.IsTrue(deserialized.Value <bool>("Prop1"));
            Expect.IsFalse(deserialized.Value <bool>("Prop2"));
            Expect.AreEqual("Banana", deserialized.Value <string>("Name"));
        }