public void Test_CopyTo_Should_Not_Copy_Nodes_When_Array_Does_Not_Have_Enough_Capacity() { //Given int[] array = new int[3]; var tree = new BinaryTreeCollection <int> { 5, 3, 6, }; //When Assert.Throws <ArgumentException>(() => tree.CopyTo(array, 1)); //Then Assert.Equal(new[] { 0, 0, 0 }, array); }
public void Test_CopyTo_Should_Copy_Nodes_When_Array_Has_Enough_Capacity() { //Given int[] array = new int[5]; var tree = new BinaryTreeCollection <int> { 5, 3, 6, }; //When tree.CopyTo(array, 1); //Then Assert.Equal(new[] { 0, 3, 5, 6, 0 }, array); }