public void Vector2CopyToTest() { Vector2D v1 = new Vector2D(2.0f, 3.0f); double[] a = new double[3]; double[] b = new double[2]; Assert.Throws <ArgumentOutOfRangeException>(() => v1.CopyTo(a, -1)); Assert.Throws <ArgumentOutOfRangeException>(() => v1.CopyTo(a, a.Length)); Assert.Throws <ArgumentException>(() => v1.CopyTo(a, 2)); v1.CopyTo(a, 1); v1.CopyTo(b); Assert.AreEqual(0.0, a[0]); Assert.AreEqual(2.0, a[1]); Assert.AreEqual(3.0, a[2]); Assert.AreEqual(2.0, b[0]); Assert.AreEqual(3.0, b[1]); }
public void Vector2CopyToTest() { Vector2D <float> v1 = new Vector2D <float>(2.0f, 3.0f); float[] a = new float[3]; float[] b = new float[2]; Assert.Throws <NullReferenceException>(() => v1.CopyTo(null, 0)); Assert.Throws <ArgumentOutOfRangeException>(() => v1.CopyTo(a, -1)); Assert.Throws <ArgumentOutOfRangeException>(() => v1.CopyTo(a, a.Length)); Assert.Throws <ArgumentException>(() => v1.CopyTo(a, 2)); v1.CopyTo(a, 1); v1.CopyTo(b); Assert.Equal(0.0, a[0]); Assert.Equal(2.0, a[1]); Assert.Equal(3.0, a[2]); Assert.Equal(2.0, b[0]); Assert.Equal(3.0, b[1]); }