// TODO: add tests with custom dicos, list of custom dicos... public void Test_DictOfDict_IsEquivalentTo() { var dictOf3_A = new Dictionary <string, string> { { "aa", "AA" }, { "bb", "BB" }, { "cc", "CC" } }; var dictOf3_B = new Dictionary <string, string> { { "cc", "CC" }, { "aa", "AA" }, { "bb", "BB" } }; var dictOf2 = new Dictionary <string, string> { { "cc", "CC" }, { "bb", "BB" } }; var dictOf2Dict_A = new Dictionary <string, Dictionary <string, string> > { { "key1", dictOf2 }, { "key2", dictOf3_A } }; var dictOf2Dict_B = new Dictionary <string, Dictionary <string, string> > { { "key2", dictOf3_B }, { "key1", dictOf2 } }; Check.That(dictOf2Dict_A).IsEquivalentTo(dictOf2Dict_B); #if !DOTNET_35 var dictOf2Dict_C = new Dictionary <string, IReadOnlyDictionary <string, string> > { { "key1", new RoDico(dictOf2) }, { "key2", new RoDico(dictOf3_B) } }; Check.That(dictOf2Dict_A).IsEquivalentTo(dictOf2Dict_C); Check.That(dictOf2Dict_C).IsEquivalentTo(dictOf2Dict_B); var customDico = new RoDico(dictOf3_B); Check.That(customDico).IsEquivalentTo(dictOf3_B); Check.That(dictOf3_B).IsEquivalentTo(customDico); #endif }
public void CanSupportBasicMethodsOnCustomDico() { var rodemo = new RoDico <int, string>(new Dictionary <int, string> { { 1, "one" }, { 2, "two" } }); var wrapped = DictionaryExtensions.WrapDictionary <object, object>(rodemo); CheckBaseMethods(wrapped); }
public void CanWrapReadonlyDictionary() { var rodemo = new RoDico <int, string>(new Dictionary <int, string> { { 1, "one" }, { 2, "two" } }); var wrapped = DictionaryExtensions.WrapDictionary <object, object>(rodemo); Check.That(wrapped).IsNotNull(); Check.That(wrapped).ContainsKey(2); }