Exemplo n.º 1
0
        public void ReturnFalseComparingDifferentValues()
        {
            var a = new PointD(1, 1);
            var b = new PointD(1, 2);

            Assert.That(a == b, Is.False);
        }
Exemplo n.º 2
0
        public void ReturnTrueComparingSameValues()
        {
            const double x = 1.0001;
            var a = new PointD(x, x);
            var b = new PointD(x, x);

            Assert.That(a == b, Is.True);
        }
Exemplo n.º 3
0
        public void ContainSameValuesAfterConstructionFromPointD()
        {
            var source = new PointD(0.0, 0.0);

            var result = new PointD(source);

            Assert.That(result, Is.EqualTo(source));
        }
Exemplo n.º 4
0
        public void BeAnotherObjectAfterConstructionFromPointD()
        {
            var source = new PointD(0.0, 0.0);

            var result = new PointD(source);

            Assert.AreNotSame(result, source, "New point should be another object");
        }
Exemplo n.º 5
0
        public void ReturnTrueComparingValuesSmallerEpsilon()
        {
            const double epsilon = IntervalD.Epsilon;
            const double x = 1.0;
            var a = new PointD(x + epsilon / 2.0, x);
            var b = new PointD(x, x);

            Assert.That(a == b, Is.True);
        }
Exemplo n.º 6
0
 public bool Equals(PointD value)
 {
     return Math.Abs(X - value.X) < Epsilon &&
            Math.Abs(Y - value.Y) < Epsilon;
 }
Exemplo n.º 7
0
 public PointD(PointD point)
     : this(point.X, point.Y)
 {
 }