public void Remove_Tests() { var pairs = new UniquePairs <long>(); Assert.IsFalse(pairs.Remove(1234)); pairs.Add(1234, 43); Assert.IsTrue(pairs.Remove(1234, out var other)); Assert.AreEqual(43, other); }
public void Long_Add_Lookup() { var pairs = new UniquePairs <long>(); pairs.Add(10, 100); Assert.AreEqual(100, pairs.Other(10)); Assert.AreEqual(10, pairs.Other(100)); Assert.IsFalse(pairs.Contains(12345)); Assert.IsTrue(pairs.Contains(10)); Assert.IsTrue(pairs.Contains(100)); Assert.IsTrue(pairs.Remove(100)); Assert.IsFalse(pairs.Contains(10)); Assert.IsFalse(pairs.Contains(100)); }
public void String_Add_Lookup() { var pairs = new UniquePairs <string>(); pairs.Add("test1", "test2"); Assert.AreEqual("test2", pairs.Other("test1")); Assert.AreEqual("test1", pairs.Other("test2")); Assert.IsFalse(pairs.Contains("12345")); Assert.IsTrue(pairs.Contains("test1")); Assert.IsTrue(pairs.Contains("test2")); pairs.Remove("test1"); Assert.IsFalse(pairs.Contains("test1")); Assert.IsFalse(pairs.Contains("test2")); }