Example #1
0
 public void Simple()
 {
     var vector = new Vector2D(4, 7);
     vector.Increment();
     Assert.AreEqual(5, vector.X);
     Assert.AreEqual(8, vector.Y);
 }
 public void OperatorDivideDoubleExample()
 {
     var vector2D = new Vector2D(4, 12);
     var vector = vector2D/2;
     Assert.AreEqual(2, vector.X);
     Assert.AreEqual(6, vector.Y);
 }
Example #3
0
 public void Simple()
 {
     var vector = new Vector2D { X = 1, Y = 2 };
     Assert.AreNotEqual(0, vector.GetHashCode());
     Assert.AreEqual(1, vector.X);
     Assert.AreEqual(2, vector.Y);
 }
        public void ExceptionLeftNull()
        {
            const Vector2D vector1 = null;
            var vector2 = new Vector2D(2, 2);

            var condition = vector1 <= vector2;
        }
Example #5
0
 public void Simple()
 {
     var vector = new Vector2D { X = 1, Y = 2 };
     vector.SetValues(4, 6);
     Assert.AreEqual(4, vector.X);
     Assert.AreEqual(6, vector.Y);
 }
        public void ExceptionRightNull()
        {
            var vector1 = new Vector2D(2, 2);
            const Vector2D vector2 = null;

            var condition = vector1 >= vector2;
        }
Example #7
0
 public void Simple()
 {
     var vector2D = new Vector2D();
     Assert.AreEqual(2, vector2D.DimensionCount);
     Assert.AreEqual(0, vector2D.X);
     Assert.AreEqual(0, vector2D.Y);
 }
 public void OperatorDivideVectorExample()
 {
     var vector2D1 = new Vector2D(4, 8);
     var vector2D2 = new Vector2D(2, 2);
     var vector = vector2D1/vector2D2;
     Assert.AreEqual(1, vector.X);
     Assert.AreEqual(2, vector.Y);
 }
Example #9
0
        public void AbsoluteMaximumExample()
        {
            var vector1 = new Vector2D(1, -4);
            Assert.AreEqual(4, vector1.AbsoluteMaximum());

            var vector2 = new Vector2D(5, -4);
             Assert.AreEqual(5, vector2.AbsoluteMaximum());
        }
Example #10
0
        public void Simple()
        {
            var vector = new Vector2D(23, 21);

            vector.Normalize();

            Assert.AreEqual(1, vector.Magnitude());
        }
Example #11
0
        public void Simple()
        {
            var vector = new Vector2D(1, -4);

            Assert.AreEqual(-4, vector.Minimum());
            Assert.AreEqual(1, vector.X);
            Assert.AreEqual(-4, vector.Y);
        }
Example #12
0
        public void AbsoluteMinimumIndexExample()
        {
            var vector1 = new Vector2D(1, -4);
            Assert.AreEqual(0, vector1.AbsoluteMinimumIndex());

            var vector2 = new Vector2D(-4, 1);
            Assert.AreEqual(1, vector2.AbsoluteMinimumIndex());
        }
Example #13
0
        public void Simple()
        {
            var vector2D = new Vector2D(4, 7);

            vector2D--;

            Assert.AreEqual(3, vector2D.X);
            Assert.AreEqual(6, vector2D.Y);
        }
Example #14
0
        public void AddDoubleExample()
        {
            var vector = new Vector2D(4, 7);

            vector.Add(1);

            Assert.AreEqual(5, vector.X);
            Assert.AreEqual(8, vector.Y);
        }
Example #15
0
        public void Simple()
        {
            var vector = new Vector2D(2, 3);

            Assert.AreEqual(5, vector.Sum());

            Assert.AreEqual(2, vector.X);
            Assert.AreEqual(3, vector.Y);
        }
Example #16
0
        public void Simple()
        {
            var vector = new Vector2D(3, 7);

            vector.Clear();

            Assert.AreEqual(0, vector.X);
            Assert.AreEqual(0, vector.Y);
        }
Example #17
0
        public void Simple()
        {
            var vector = new Vector2D(2, 3);

            Assert.AreEqual(3.6055512754639891d, vector.Magnitude());

            Assert.AreEqual(2, vector.X);
            Assert.AreEqual(3, vector.Y);
        }
Example #18
0
        public void Simple()
        {
            var vector = new Vector2D(2, 3);

            Assert.AreEqual(6, vector.Product());

            Assert.AreEqual(2, vector.X);
            Assert.AreEqual(3, vector.Y);
        }
Example #19
0
        public void Double()
        {
            var vector = new Vector2D(9, 3);

            vector.Divide(3);

            Assert.AreEqual(3, vector.X);
            Assert.AreEqual(1, vector.Y);
        }
Example #20
0
        public void Simple()
        {
            var vector = new Vector2D(1, 2);

            vector.Negate();

            Assert.AreEqual(-1, vector.X);
            Assert.AreEqual(-2, vector.Y);
        }
        public void OperatorDecrementExample()
        {
            var vector2D = new Vector2D(4, 7);

            vector2D--;

            Assert.AreEqual(3, vector2D.X);
            Assert.AreEqual(6, vector2D.Y);
        }
Example #22
0
        public void Double()
        {
            var vector = new Vector2D(1, 2);

            vector.Multiply(2);

            Assert.AreEqual(2, vector.X);
            Assert.AreEqual(4, vector.Y);
        }
Example #23
0
        public void Simple()
        {
            var vector = new Vector2D(4, 7);

            vector.Decrement();

            Assert.AreEqual(3, vector.X);
            Assert.AreEqual(6, vector.Y);
        }
Example #24
0
        public void DifferentValues()
        {
            var vector1 = new Vector2D(1, 0);
            var vector2 = new Vector2D(2, 0);

            Assert.IsFalse(vector1.Equals(vector2));

            Assert.AreEqual(1, vector1.X);
            Assert.AreEqual(2, vector2.X);
        }
        public void Simple()
        {
            var vector1 = new Vector2D(1, 1);
            var vector2 = new Vector2D(2, 2);
            var vector3 = new Vector2D(2, 2);

            Assert.IsFalse(vector1 >= vector2);
            Assert.IsTrue(vector2 >= vector1);
            Assert.IsTrue(vector2 >= vector3);
        }
Example #26
0
 public void Simple()
 {
     var vector2D = new Vector2D { X = 1, Y = 2 };
     var vector = -vector2D;
     Assert.AreEqual(-1, vector.X);
     Assert.AreEqual(-2, vector.Y);
     Assert.AreEqual(1, vector2D.X);
     Assert.AreEqual(2, vector2D.Y);
     Assert.AreNotSame(vector2D, vector);
 }
Example #27
0
 public void Double()
 {
     var vector2D = new Vector2D(4, 7);
     var vector = vector2D + 2;
     Assert.AreEqual(6, vector.X);
     Assert.AreEqual(9, vector.Y);
     Assert.AreEqual(4, vector2D.X);
     Assert.AreEqual(7, vector2D.Y);
     Assert.AreNotSame(vector2D, vector);
 }
Example #28
0
        public void Double()
        {
            var vector = new Vector2D(4, 7)
                             {
                                 1
                             };

            Assert.AreEqual(5, vector.X);
            Assert.AreEqual(8, vector.Y);
        }
Example #29
0
 public void Simple()
 {
     var vector2D1 = new Vector2D { X = 1, Y = 2 };
     var vector2D2 = new Vector2D { X = 1, Y = 2 };
     Assert.IsTrue(vector2D1 == vector2D2);
     Assert.AreEqual(1, vector2D1.X);
     Assert.AreEqual(2, vector2D1.Y);
     Assert.AreEqual(1, vector2D2.X);
     Assert.AreEqual(2, vector2D2.Y);
 }
Example #30
0
        public void Simple()
        {
            var vector = new Vector2D(8, 3);

            var actual = vector.ToArray();

            Assert.AreEqual(2, actual.Length);
            Assert.AreEqual(8, actual[0]);
            Assert.AreEqual(3, actual[1]);
        }