public void TestContainsKey1() { Assert.IsTrue(dict1.ContainsKey(alice)); Assert.IsTrue(dict1.ContainsKey(bob)); Assert.IsTrue(dict1.ContainsKey(cedric)); Assert.IsFalse(dict1.ContainsKey(dora)); }
public void TestNested() { dict4 = new TinyDictionary <ushort, IDictionary <ushort, ArrowDirection> >(); IDictionary <ushort, ArrowDirection> innerDict1 = new TinyDictionary <ushort, ArrowDirection>(); dict4.Add(1270, innerDict1); innerDict1.Add(1270, ArrowDirection.Turn); innerDict1.Add(14929, ArrowDirection.Forward); innerDict1.Add(26395, ArrowDirection.Left); IDictionary <ushort, ArrowDirection> innerDict2 = new TinyDictionary <ushort, ArrowDirection>(); dict4.Add(14929, innerDict2); innerDict2.Add(1270, ArrowDirection.Forward); innerDict2.Add(14929, ArrowDirection.Turn); innerDict2.Add(26395, ArrowDirection.Right); IDictionary <ushort, ArrowDirection> innerDict3 = new TinyDictionary <ushort, ArrowDirection>(); dict4.Add(26395, innerDict3); innerDict3.Add(1270, ArrowDirection.Right); innerDict3.Add(14929, ArrowDirection.Left); innerDict3.Add(26395, ArrowDirection.Turn); Assert.AreEqual(3, dict4.Count); Assert.IsTrue(dict4.ContainsKey(1270)); Assert.IsTrue(dict4.ContainsKey(14929)); Assert.IsTrue(dict4.ContainsKey(26395)); Assert.AreEqual(3, dict4[1270].Count); Assert.AreEqual(3, dict4[14929].Count); Assert.AreEqual(3, dict4[26395].Count); Assert.IsTrue(dict4[1270].ContainsKey(1270)); Assert.IsTrue(dict4[1270].ContainsKey(14929)); Assert.IsTrue(dict4[1270].ContainsKey(26395)); Assert.IsTrue(dict4[14929].ContainsKey(1270)); Assert.IsTrue(dict4[14929].ContainsKey(14929)); Assert.IsTrue(dict4[14929].ContainsKey(26395)); Assert.IsTrue(dict4[26395].ContainsKey(1270)); Assert.IsTrue(dict4[26395].ContainsKey(14929)); Assert.IsTrue(dict4[26395].ContainsKey(26395)); Assert.AreEqual(ArrowDirection.Turn, dict4[1270][1270]); Assert.AreEqual(ArrowDirection.Forward, dict4[1270][14929]); Assert.AreEqual(ArrowDirection.Left, dict4[1270][26395]); Assert.AreEqual(ArrowDirection.Forward, dict4[14929][1270]); Assert.AreEqual(ArrowDirection.Turn, dict4[14929][14929]); Assert.AreEqual(ArrowDirection.Right, dict4[14929][26395]); Assert.AreEqual(ArrowDirection.Right, dict4[26395][1270]); Assert.AreEqual(ArrowDirection.Left, dict4[26395][14929]); Assert.AreEqual(ArrowDirection.Turn, dict4[26395][26395]); }
public void TestContainsKey2() { Assert.IsTrue(dict2.ContainsKey(alice)); Assert.IsTrue(dict2.ContainsKey(bob)); Assert.IsTrue(dict2.ContainsKey(cedric)); Assert.IsTrue(dict2.ContainsKey(dora)); Assert.IsFalse(dict2.ContainsKey("Eugen")); }
public void TestContainsKey3() { Assert.IsTrue(dict3.ContainsKey(girls)); Assert.IsTrue(dict3.ContainsKey(boys)); Assert.IsFalse(dict3.ContainsKey(new HashSet <string> { "Chair" })); Assert.IsFalse(dict3.ContainsKey(null)); }
public void TestContainsKey0() { Assert.IsFalse(dict0.ContainsKey(0)); }