コード例 #1
0
        public bool IsMatch(Property agencyProperty, Property databaseProperty)
        {
            Ensure.NotNull(agencyProperty, "agencyProperty");
            Ensure.NotNull(databaseProperty, "databaseProperty");

            var sCoord = new Coordinate(agencyProperty.Latitude, agencyProperty.Longitude);
            var eCoord = new Coordinate(databaseProperty.Latitude, databaseProperty.Longitude);

            return sCoord.GetDistanceInMetres(eCoord) <= sensitivityInMetres;
        }
コード例 #2
0
        public void Should_be_within_the_range_of_half_a_metre_to_microsofts_implementation()
        {
            var sut = new Coordinate(33, 151);
            var other = new Coordinate(32.999098M, 150.998147M); //200 metres away

            var ms = new GeoCoordinate(33, 151);
            var otherMs = new GeoCoordinate(32.999098, 150.998147);

            var result = sut.GetDistanceInMetres(other);
            var expected = ms.GetDistanceTo(otherMs);

            result.ShouldBeInRange(expected - .5, expected + .5);
        }