public void TestIndexOf() { var list = new List <string> { "aaa", "bbb", "ccc" }; var set = new ObservableSet <string>(list); Assert.Equal(set.IndexOf("aaa"), 0); Assert.Equal(set.IndexOf("bbb"), 1); Assert.Equal(set.IndexOf("ccc"), 2); Assert.Equal(set.IndexOf("ddd"), -1); set.Add("ddd"); Assert.Equal(set.IndexOf("ddd"), 3); set.Remove("bbb"); Assert.Equal(set.IndexOf("bbb"), -1); Assert.Equal(set.IndexOf("ddd"), 2); }
public void TestIndexOf() { var list = new List <string> { "aaa", "bbb", "ccc" }; var set = new ObservableSet <string>(list); Assert.Equal(0, set.IndexOf("aaa")); Assert.Equal(1, set.IndexOf("bbb")); Assert.Equal(2, set.IndexOf("ccc")); Assert.Equal(-1, set.IndexOf("ddd")); set.Add("ddd"); Assert.Equal(3, set.IndexOf("ddd")); set.Remove("bbb"); Assert.Equal(-1, set.IndexOf("bbb")); Assert.Equal(2, set.IndexOf("ddd")); }
public void TestIndexOf() { var list = new List<string> { "aaa", "bbb", "ccc" }; var set = new ObservableSet<string>(list); Assert.AreEqual(set.IndexOf("aaa"), 0); Assert.AreEqual(set.IndexOf("bbb"), 1); Assert.AreEqual(set.IndexOf("ccc"), 2); Assert.AreEqual(set.IndexOf("ddd"), -1); set.Add("ddd"); Assert.AreEqual(set.IndexOf("ddd"), 3); set.Remove("bbb"); Assert.AreEqual(set.IndexOf("bbb"), -1); Assert.AreEqual(set.IndexOf("ddd"), 2); }