Exemplo n.º 1
0
        public void AddTest()
        {
            int[] x        = { 1, 2, 3 };
            int[] y        = { 10, 20, 30 };
            int[] expected = { 11, 22, 33 };
            int[] actual   = new int[x.Length];

            VectorOp.Add(x, y, actual);
            Assert.Equal(expected, actual);
        }
Exemplo n.º 2
0
        public void ThrowsExceptionWhenLengthsUnequal()
        {
            int[] x      = { 1, 2, 3 };
            int[] y      = { 10, 20 };
            int[] result = new int[x.Length];

            Action action = () => { VectorOp.Add(x, y, result); };
            bool   thrown = AssertUtils.TestException <IndexOutOfRangeException>(action);

            Assert.True(thrown);
        }