コード例 #1
0
        public void DistanceBetween_NauticalMiles_Valid()
        {
            // Arrange
            IGeoLocation location1 = A.Fake <IGeoLocation>();
            IGeoLocation location2 = A.Fake <IGeoLocation>();

            location1.Latitude  = 39.90120981809262;
            location1.Longitude = -75.17199754714966;

            location2.Latitude  = 39.9128075;
            location2.Longitude = -75.1725466;

            // Act
            var result = location1.DistanceBetween(location2, GeoLocationDistanceUnits.NauticalMiles);

            // Assert
            result.Should().Be(0.69662209391339824);
        }
コード例 #2
0
        public void DistanceBetween_Meters_Valid()
        {
            // Arrange
            IGeoLocation location1 = A.Fake <IGeoLocation>();
            IGeoLocation location2 = A.Fake <IGeoLocation>();

            location1.Latitude  = 39.90120981809262;
            location1.Longitude = -75.17199754714966;

            location2.Latitude  = 39.9128075;
            location2.Longitude = -75.1725466;

            // Act
            var result = location1.DistanceBetween(location2, GeoLocationDistanceUnits.Meters);

            // Assert
            result.Should().Be(1290.3913797601157967);
        }