/// <summary> /// /// </summary> /// [Test] public void CreateAndFetchDictionaryAndMetadata() { metadataWrapper mdw = new metadataWrapper(); metadataWrapperEntry datum = new metadataWrapperEntry(); datum.key = "SomeKey"; datum.value = "SomeValue"; metadataWrapperEntry datum2 = new metadataWrapperEntry(); datum2.key = "AnotherKey"; datum2.value = "AnotherValue"; mdw.contents = new metadataWrapperEntry[] { datum, datum2 }; string dictId = riddler.createDictionary(mdw); string retrieved = riddler.getDictionary(mdw); Assert.AreEqual(dictId, retrieved); metadataWrapper mdwRetrieved = riddler.getDictionaryMetadata(dictId); // annoyance-- have to use an IDictionary because we need to specify an equality comparator // (you don't get one for free from the stub impl of metadataWrapperEntry) IDictionary <metadataWrapperEntry, int> tmpDict = new Dictionary <metadataWrapperEntry, int>(new EntryComparer()); foreach (metadataWrapperEntry e in mdwRetrieved.contents) { tmpDict.Add(new KeyValuePair <metadataWrapperEntry, int>(e, 42)); } Assert.IsTrue(tmpDict.Contains(new KeyValuePair <metadataWrapperEntry, int>(datum, 42))); Assert.IsTrue(tmpDict.Contains(new KeyValuePair <metadataWrapperEntry, int>(datum2, 42))); }
public void FetchNonexistentDictionary() { metadataWrapper mdw = new metadataWrapper(); metadataWrapperEntry datum = new metadataWrapperEntry(); datum.key = "KeyX"; datum.value = "ValueY"; mdw.contents = new metadataWrapperEntry[] { datum }; riddler.getDictionary(mdw); }