Example #1
0
        public void TestReadAtMultipleEntries([Column(1, "str", 3.14)] object fieldA, [Column(2, "str2", 4.14)] object fieldB, [Column(16, "str3", 23.14)] object fieldC)
        {
            var nspace = "http://namespace/";

            var bag = new MockPropertyBag();

            bag.Write("fieldA", nspace, fieldA);
            bag.Write("fieldB", nspace, fieldB);
            bag.Write("fieldC", nspace, fieldC);

            Assert.AreEqual(fieldA, bag.Read("fieldA", nspace));
            Assert.AreEqual(fieldB, bag.Read("fieldB", nspace));
            Assert.AreEqual(fieldC, bag.Read("fieldC", nspace));

            object readValue;
            string readNamespace;
            string readName;

            readValue = bag.ReadAt(0, out readName, out readNamespace);
            Assert.AreEqual(fieldA, readValue);
            Assert.AreEqual("fieldA", readName);
            Assert.AreEqual(nspace, readNamespace);
            readValue = bag.ReadAt(1, out readName, out readNamespace);
            Assert.AreEqual(fieldB, readValue);
            Assert.AreEqual("fieldB", readName);
            Assert.AreEqual(nspace, readNamespace);
            readValue = bag.ReadAt(2, out readName, out readNamespace);
            Assert.AreEqual(fieldC, readValue);
            Assert.AreEqual("fieldC", readName);
            Assert.AreEqual(nspace, readNamespace);

            Assert.AreEqual <uint>(3u, bag.CountProperties);
        }
Example #2
0
        public void TestUpdateOneEntry(string name, string nspace, object oldValue, object newValue)
        {
            var bag = new MockPropertyBag();

            bag.Write(name, nspace, oldValue);
            Assert.AreEqual(oldValue, bag.Read(name, nspace));
            Assert.AreEqual <uint>(1u, bag.CountProperties);
            bag.Write(name, nspace, newValue);

            Assert.AreEqual(newValue, bag.Read(name, nspace));
            Assert.AreEqual <uint>(1u, bag.CountProperties);
        }
Example #3
0
        public void TestAddMultipleEntries([Column(1, "str", 3.14)] object fieldA, [Column(2, "str2", 4.14)] object fieldB, [Column(16, "str3", 23.14)] object fieldC)
        {
            var nspace = "http://namespace/";

            var bag = new MockPropertyBag();

            bag.Write("fieldA", nspace, fieldA);
            bag.Write("fieldB", nspace, fieldB);
            bag.Write("fieldC", nspace, fieldC);

            Assert.AreEqual(fieldA, bag.Read("fieldA", nspace));
            Assert.AreEqual(fieldB, bag.Read("fieldB", nspace));
            Assert.AreEqual(fieldC, bag.Read("fieldC", nspace));
            Assert.AreEqual <uint>(3u, bag.CountProperties);
        }
Example #4
0
        public void TestStoreObject(string name, string nspace, object value)
        {
            var bag = new MockPropertyBag();

            bag.Write(name, nspace, value);

            Assert.AreEqual(value, bag.Read(name, nspace));
            Assert.AreEqual <uint>(1u, bag.CountProperties);
        }