public void PeekShouldPeekSourceStack() { // arrange var source = new Stack<object>(); var target = new StackAdapter<object>( source ); // act target.Push( new object() ); // assert Assert.Equal( source.Peek(), target.Peek() ); }
public void CopyToShouldCopySourceStack() { // arrange var expected = new[] { new object(), new object(), new object() }; var source = new Stack<object>( expected ); var target = new StackAdapter<object>( source ); var actual = new object[3]; // act target.CopyTo( actual, 0 ); // assert Assert.True( actual.SequenceEqual( expected.Reverse() ) ); }
public void ClearShouldClearSourceStack() { // arrange var source = new Stack<object>(); var target = new StackAdapter<object>( source ); target.Push( new object() ); // act target.Clear(); // assert Assert.Equal( 0, source.Count ); Assert.Equal( 0, target.Count ); }
public void PopShouldPopSourceStack() { // arrange var source = new Stack<object>(); var target = new StackAdapter<object>( source ); target.Push( new object() ); var expected = source.Peek(); // act var actual = target.Pop(); // assert Assert.Equal( expected, actual ); }