Пример #1
0
        public static bool TestClone2()
        {
            //arrange
            IArrayVector expected = new ArrayVector(new double[] { 1, 2, 3, 4 });

            double[] expected1 = expected.Get();

            //act
            IArrayVector actual = expected.Clone();

            actual.Set(2, 6);

            //assert
            return(Enumerable.SequenceEqual(expected.Get(), expected1));
        }
Пример #2
0
        public static bool TestSortAscending()
        {
            //arrange
            IArrayVector actual   = new ArrayVector(new double[] { 5, 4, 3, 2, 1 });
            IArrayVector expected = new ArrayVector(new double[] { 1, 2, 3, 4, 5 });

            //act
            actual.SortAscending();

            //assert
            return(Enumerable.SequenceEqual(actual.Get(), expected.Get()));
        }
Пример #3
0
        public static bool TestGetByIndex3()
        {
            //arrange
            IArrayVector array    = new ArrayVector(new double[] { 1, 2, 3, 4 });
            double       expected = 4;

            //act
            double actual = array.Get(3);

            //assert
            return(actual.Equals(expected));
        }
Пример #4
0
        public static bool TestMult()
        {
            //arrange
            IArrayVector expected = new ArrayVector(new double[] { 2, 4, 6, 8, 10 });
            IArrayVector actual   = new ArrayVector(new double[] { 1, 2, 3, 4, 5 });

            //act
            actual.Mult(2);

            //assert
            return(Enumerable.SequenceEqual(expected.Get(), actual.Get()));
        }
Пример #5
0
        public static bool TestSum()
        {
            //arrange
            IArrayVector currentVector = new ArrayVector(new double[] { 1, 1, 1, 1 });
            IArrayVector anotherVector = new ArrayVector(new double[] { 1, 1, 1 });
            IArrayVector expected      = new ArrayVector(new double[] { 2, 2, 2 });

            //act
            IArrayVector actual = currentVector.Sum(anotherVector);

            //assert
            return(Enumerable.SequenceEqual(actual.Get(), expected.Get()));
        }
Пример #6
0
        public static bool TestGet()
        {
            //arrange
            IArrayVector instance = new ArrayVector(new double[] { 1, 2, 3, 4 });

            double[] expected = new double[] { 1, 2, 3, 4 };

            //act
            double[] actual = instance.Get();

            //assert
            return(Enumerable.SequenceEqual(actual, expected));
        }
Пример #7
0
        public static bool TestSetByIndex4()
        {
            #region Test
            //arrange
            IArrayVector actual   = new ArrayVector(new double[] { 1, 2, 3, 4, 5 });
            IArrayVector expected = new ArrayVector(new double[] { 1, 2, 6, 4, 5 });

            //act
            actual.Set(2, 6);

            //assert
            return(Enumerable.SequenceEqual(actual.Get(), expected.Get()));

            #endregion
        }