public void ConvertsFlatMetadataCollectionToList() { var objectWithMetadata = DictionaryMetadataFactory.CreateFlatObjectWithMetadata(); var flatList = objectWithMetadata.ToStaticMetadataList(); Assert.AreEqual(3, flatList.Count); Assert.AreEqual(null, flatList[0].Value); Assert.AreEqual(42, flatList[1].Value); Assert.AreEqual("works", flatList[2].Value); }
public void ConvertsFlatMetadataCollectionToList() { var objectWithMetadata = DictionaryMetadataFactory.CreateFlatObjectWithMetadata(); var dictionary = objectWithMetadata.ToStaticMetadataDictionary(); Assert.AreEqual(3, dictionary.Count); Assert.AreEqual(null, dictionary["StringProperty"].Value); Assert.AreEqual(42, dictionary["IntProperty"].Value); Assert.AreEqual("works", dictionary["ExistingProperty"].Value); }
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); }
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); } }
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); }
public void ConvertsHierarchicalMetadataCollectionToList() { var objectWithMetadata = DictionaryMetadataFactory.CreateHierarchicalObjectWithMetadata(); var dictionary = objectWithMetadata.ToStaticMetadataDictionary(); Assert.AreEqual(3, dictionary.Count); Assert.AreEqual("#FFFF0000", dictionary["Name"].Value); Assert.AreEqual("#FFFF0000", dictionary["RGB"].Value); var subDictionary = (Dictionary <string, IMetadataValue>)dictionary["Color"].Value; Assert.AreEqual(4, subDictionary.Count); Assert.AreEqual(255, subDictionary["A"].Value); Assert.AreEqual(255, subDictionary["R"].Value); Assert.AreEqual(0, subDictionary["G"].Value); Assert.AreEqual(0, subDictionary["B"].Value); }