예제 #1
0
파일: PointDShould.cs 프로젝트: Diover/nets
        public void ReturnFalseComparingDifferentValues()
        {
            var a = new PointD(1, 1);
            var b = new PointD(1, 2);

            Assert.That(a == b, Is.False);
        }
예제 #2
0
파일: PointDShould.cs 프로젝트: Diover/nets
        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
파일: PointDShould.cs 프로젝트: Diover/nets
        public void ContainSameValuesAfterConstructionFromPointD()
        {
            var source = new PointD(0.0, 0.0);

            var result = new PointD(source);

            Assert.That(result, Is.EqualTo(source));
        }
예제 #4
0
파일: PointDShould.cs 프로젝트: Diover/nets
        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
파일: PointDShould.cs 프로젝트: Diover/nets
        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)
 {
 }