public void StackCopyToWithNullArrayThrowsException() { //Arrange var stack = new StaticStack <string>(5); var emptyArray = default(string[]); //Act stack.Push("one"); stack.Push("two"); stack.Push("three"); stack.Push("four"); stack.Push("five"); stack.CopyTo(emptyArray, 0); //Assert }
public void StackCopyToWithBiggerIndexThanStackLengthThrowsException() { //Arrange var stack = new StaticStack <string>(5); var emptyArray = new string[5]; //Act stack.Push("one"); stack.Push("two"); stack.Push("three"); stack.Push("four"); stack.Push("five"); stack.CopyTo(emptyArray, 6); //Assert }
public void StackCopyToWorksCorrectly() { //Arrange var stack = new StaticStack <string>(5); var emptyArray = new string[3]; var expectedArray = new string[] { "three", "two", "one" }; //Act stack.Push("one"); stack.Push("two"); stack.Push("three"); stack.CopyTo(emptyArray, 0); //Assert CollectionAssert.AreEqual(expectedArray, emptyArray); }