public void ValidatesIndexOfMethodAndDoesNotReturnIndex() { var test = new ListCollection <int>(); test.Add(5); test.Add(4); Assert.Equal(-1, test.IndexOf(1000)); }
public void ValidatesContainMethodAndDoesNotFindElement() { var test = new ListCollection <int>(); test.Add(1); test.Add(3); Assert.DoesNotContain(2, test); }
public void ValidatesIndexOfMethodAndReturnsIndex() { var test = new ListCollection <int>(); test.Add(5); test.Add(3); Assert.Equal(1, test.IndexOf(3)); }
public void ValidatesContainMethodAndFindsElement() { var test = new ListCollection <int>(); test.Add(1); test.Add(3); Assert.Contains(1, test); }
public void ValidatesRemoveAtMethod() { var test = new ListCollection <int>(); test.Add(5); test.Add(3); test.RemoveAt(0); Assert.Equal(3, test[0]); }
public void ValidatesIListRemoveMethod() { var test = new ListCollection <int>(); test.Add(5); test.Add(6); test.Add(4); test.Add(1); Assert.True(test.Remove(5)); }
public void ValidatesIListRemoveMethodAndDoesNotFindElement() { var test = new ListCollection <int>(); test.Add(5); test.Add(6); test.Add(4); test.Add(1); Assert.False(test.Remove(15)); }
public void ValidatesCountMethod() { var test = new ListCollection <int>(); test.Add(5); test.Add(3); test.Add(2); test.Add(6); test.Add(7); Assert.Equal(5, test.Count); }
public void ValidatesInsertMethod() { var test = new ListCollection <int>(); test.Add(5); test.Add(3); test.Insert(0, 1); Assert.Equal(1, test[0]); Assert.Equal(5, test[1]); Assert.Equal(3, test[2]); Assert.Equal(3, test.Count); }
public void ValidatesAddMethod() { var test = new ListCollection <int>(); test.Add(1); test.Add(2); test.Add(3); test.Add(6); test.Add(7); Assert.Equal(1, test[0]); Assert.Equal(2, test[1]); Assert.Equal(3, test[2]); Assert.Equal(6, test[3]); Assert.Equal(7, test[4]); }
public void ValidatesSetElementMethod() { var test = new ListCollection <int>(); test.Add(5); test[0] = 6; Assert.Equal(6, test[0]); }
public void AddMethodIsReadonlyException() { var testList = new ListCollection <int> { 1, 2 }; testList = testList.ReadOnlyList(); Assert.Throws <NotSupportedException>(() => testList.Add(2)); }
public void IterationTest() { var testArray = new ListCollection <int> { 1, 2, 3, 4 }; var cloneTestArray = new ListCollection <int>(); foreach (var obj in testArray) { cloneTestArray.Add(obj); } Assert.Equal(1, cloneTestArray[0]); Assert.Equal(2, cloneTestArray[1]); Assert.Equal(3, cloneTestArray[2]); Assert.Equal(4, cloneTestArray[3]); }