public void KeyValuePairDoesNotExist() { var sut = new BijectiveDictionary <string, int> { { "FooBar", 0 }, { "Testing123", 2 } }; Assert.IsFalse(sut.Contains(new KeyValuePair <string, int>("FooBar", 7))); }
public void CountsAreEqual() { var sut = new BijectiveDictionary <string, int> { { "FooBar", 0 }, { "Testing123", 2 } }; Assert.IsTrue(sut.Count == sut.Inverse.Count); }
public void BothKeysExist() { var sut = new BijectiveDictionary <string, int> { { "FooBar", 0 }, { "Testing123", 2 } }; Assert.AreEqual("FooBar", sut.Inverse[0]); Assert.AreEqual(0, sut["FooBar"]); }
public void BothBijectionsCleared() { var sut = new BijectiveDictionary <string, int> { { "FooBar", 0 }, { "Testing123", 2 } }; sut.Clear(); Assert.IsTrue(sut.Count == 0 && sut.Inverse.Count == 0); }
public void BothKeysRemovedByKeyValuePair() { var sut = new BijectiveDictionary <string, int> { { "FooBar", 0 }, { "Testing123", 2 } }; sut.Remove(new KeyValuePair <string, int>("Testing123", 2)); Assert.IsFalse(sut.Inverse.ContainsKey(2)); }
public void BothBijectionsSet() { var sut = new BijectiveDictionary <string, int> { { "FooBar", 0 }, { "Testing123", 2 } }; sut["BarFoo"] = 42; Assert.AreEqual(42, sut["BarFoo"]); Assert.AreEqual("BarFoo", sut.Inverse[42]); }
public BijectiveDictionary() { this.Reversed = new BijectiveDictionary <TValue, TKey>(true); this.Reversed.Reversed = this; }