public void SetterWorks() { var c = new FastCollection<int> { 1 }; Assert.Equal(1, c[0]); Assert.True(c.Contains(1)); Assert.False(c.Contains(2)); c[0] = 2; Assert.Equal(2, c[0]); Assert.False(c.Contains(1)); Assert.True(c.Contains(2)); c.Add(3); Assert.False(c.Contains(1)); Assert.True(c.Contains(2)); Assert.True(c.Contains(3)); Assert.False(c.Contains(4)); c[c.IndexOf(3)] = 4; Assert.False(c.Contains(1)); Assert.True(c.Contains(2)); Assert.False(c.Contains(3)); Assert.True(c.Contains(4)); c[c.IndexOf(4)] = 2; Assert.False(c.Contains(1)); Assert.True(c.Contains(2)); Assert.False(c.Contains(3)); Assert.False(c.Contains(4)); Assert.Equal(2, c.Count); }
public void ContainsWorks() { var c = new FastCollection<int> { 1, 2, 3 }; Assert.True(c.Contains(1)); Assert.True(c.Contains(2)); Assert.True(c.Contains(3)); Assert.False(c.Contains(4)); c.Remove(1); Assert.False(c.Contains(1)); Assert.True(c.Contains(2)); Assert.True(c.Contains(3)); Assert.False(c.Contains(4)); c.Clear(); Assert.False(c.Contains(1)); Assert.False(c.Contains(2)); Assert.False(c.Contains(3)); c.Add(3); Assert.False(c.Contains(1)); Assert.False(c.Contains(2)); Assert.True(c.Contains(3)); }