//----------------------------------------------------------------------- // // Copyright (c) 2009 Deltares. All rights reserved. // // B.S.T.I.M. The // tom.the@deltares.nl // 03-06-2010 // Test of GeometryPoint object //----------------------------------------------------------------------- using Deltares.Geometry; namespace Deltares.Dam.Tests { using Deltares.Dam.Data; using NUnit.Framework; [TestFixture] public class PointTest { [Test] public void PointsAreEqualsWhenHavingOfInstance() { var point1 = new GeometryPoint() { X = 1.002, Y = 14.22, Z = 23.563 }; var point2 = point1; Assert.IsTrue(point1.LocationEquals(point2)); } [Test] public void PointsAreEqualWhenHavingSameValues() { var point1 = new GeometryPoint() { X = 1.002, Y = 14.22, Z = 23.563 }; var point2 = new GeometryPoint() { X = 1.002, Y = 14.22, Z = 23.563 }; Assert.IsTrue(point1.LocationEquals(point2)); } [Test] public void PointsAreEqualWhenHavingSameValuesUsingEqualityOperator() { var point1 = new GeometryPoint() { X = 1.002, Y = 14.22, Z = 23.563 }; var point2 = new GeometryPoint() { X = 1.002, Y = 14.22, Z = 23.563 }; Assert.IsTrue(point1.LocationEquals(point2)); } [Test] public void PointsAreNotEqualWhenHavingSameValuesUsingInvertedEqualityOperator() { var point1 = new GeometryPoint() { X = 1.002, Y = 14.22, Z = 23.563 }; var point2 = new GeometryPoint() { X = 1.003, Y = 14.23, Z = 23.562 }; Assert.IsFalse(point1.LocationEquals(point2)); } [Test] public void PointsAreEqualWhenHavingSameXValues() { var point1 = new GeometryPoint() { X = 1.002}; var point2 = new GeometryPoint() { X = 1.002 }; Assert.IsTrue(point1.LocationEquals(point2)); } [Test] public void PointsAreEqualWhenHavingSameYValues() { var point1 = new GeometryPoint() { Y = 14.22 }; var point2 = new GeometryPoint() { Y = 14.22 }; Assert.IsTrue(point1.LocationEquals(point2)); } [Test] public void PointsAreEqualWhenHavingSameZValues() { var point1 = new GeometryPoint() { Z = 23.563 }; var point2 = new GeometryPoint() { Z = 23.563 }; Assert.IsTrue(point1.LocationEquals(point2)); } } }