public void AddTest_Single_Pass() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 } }; Assert.Equal(dict.ToArray(), new[] { new KeyValuePair <int, int>(0, 815) }); }
public void TryAddTest_Duplicate_Fail() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 }, }; Assert.False(dict.TryAdd(0, 888)); }
public void GetTest_Exists_Pass() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 }, }; Assert.Equal(815, dict.Get(0)); }
public void TryGetValueTest_Missing_Pass() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 }, }; Assert.False(dict.TryGetValue(42, out _)); }
public void TryGetFirstTest_Missing_Pass() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 }, }; Assert.False(dict.TryGetFirst(888, out var unused)); }
public void TryAddTest_Unique_Pass() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 }, }; Assert.True(dict.TryAdd(42, 888)); }
public void TryGetValueTest_Exists_Pass() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 }, }; Assert.True(dict.TryGetValue(0, out var second)); Assert.Equal(815, second); }
public void TryGetFirstTest_Exists_Pass() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 }, }; Assert.True(dict.TryGetFirst(815, out var first)); Assert.Equal(0, first); }
public void GetTest_Missing_Fail() { var dict = new BiDictionaryOneToOne <int, int> { { 0, 815 }, }; object Check() => dict.Get(42); Assert.Throws <ArgumentException>(Check); }