public void Test5() { var d = new BidirectionalMap <int, int>(); d.Add(new Tuple <int, int>(1, 5)); d.Add(new Tuple <int, int>(2, 6)); d.Add(new Tuple <int, int>(3, 7)); Assert.AreEqual(d.Count, 3); Assert.AreEqual(d.GetLeft(7), 3); Assert.AreEqual(d.GetRight(3), 7); Assert.ThrowsException <Exception>(() => { var e = d.GetLeft(11); }); Assert.ThrowsException <Exception>(() => { var e = d.GetRight(11); }); }
public void Test6() { var d = new BidirectionalMap <string, int>(new Dictionary <string, int>() { { "Col1", 1 }, { "Col2", 2 }, { "Col3", 3 } }); Assert.AreEqual(d.Count, 3); Assert.AreEqual(d.GetLeft(1), "Col1"); Assert.AreEqual(d.GetRight("Col3"), 3); Assert.ThrowsException <ItemsNotOneToOneException>(() => { d.Add(new Tuple <string, int>("Col1", 3)); }); }
public override string GetName(int i) => _nameToOrdinalMapping.GetLeft(i);