Пример #1
0
        public void TheAllProperty()
        {
            var metadataCollection = DictionaryMetadataFactory.CreateMetadataCollection();

            var all = metadataCollection.All.ToList();

            Assert.AreEqual(3, all.Count);
            Assert.AreEqual("StringProperty", all[0].Name);
            Assert.AreEqual("IntProperty", all[1].Name);
            Assert.AreEqual("ExistingProperty", all[2].Name);
        }
Пример #2
0
        public void TheGetMetadataMethod(string metadataName, bool shouldExist)
        {
            var metadataCollection = DictionaryMetadataFactory.CreateMetadataCollection();
            var metadata           = metadataCollection.GetMetadata(metadataName);

            if (shouldExist)
            {
                Assert.IsNotNull(metadata);
            }
            else
            {
                Assert.IsNull(metadata);
            }
        }
Пример #3
0
        public void TheGetValueMethod(string metadataName, object expectedValue)
        {
            var metadataCollection = DictionaryMetadataFactory.CreateMetadataCollection();

            var dictionary = new Dictionary <string, object>();

            dictionary["ExistingProperty"] = "works";
            dictionary["StringProperty"]   = null;
            dictionary["IntProperty"]      = 42;

            var metadata    = metadataCollection.GetMetadata(metadataName);
            var actualValue = metadata.GetValue(dictionary);

            Assert.AreEqual(expectedValue, actualValue);
        }