コード例 #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)
 {
 }