コード例 #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);
        }
コード例 #2
0
        public void TestReadAtMethod(string name, string nspace, object value)
        {
            var bag = new MockPropertyBag();

            bag.Write(name, nspace, value);

            string readName;
            string readNamespace;
            var    valueRead = bag.ReadAt(0, out readName, out readNamespace);

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