示例#1
0
        public void ReturnFalseComparingDifferentValues()
        {
            var a = new PointD(1, 1);
            var b = new PointD(1, 2);

            Assert.That(a == b, Is.False);
        }
示例#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);
        }
示例#3
0
        public void ContainSameValuesAfterConstructionFromPointD()
        {
            var source = new PointD(0.0, 0.0);

            var result = new PointD(source);

            Assert.That(result, Is.EqualTo(source));
        }
示例#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");
        }
示例#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);
        }
示例#6
0
文件: PointD.cs 项目: Diover/nets
 public bool Equals(PointD value)
 {
     return Math.Abs(X - value.X) < Epsilon &&
            Math.Abs(Y - value.Y) < Epsilon;
 }
示例#7
0
文件: PointD.cs 项目: Diover/nets
 public PointD(PointD point)
     : this(point.X, point.Y)
 {
 }