public void NewCoordinate_LongitudeLessThanNegative180Degrees_ThrowsInvalidCoordinateException()
        {
            var latitude  = 53.339428;
            var longitude = -180.000001;

            var coordinate = new DegreeCoordinate(latitude, longitude);
        }
        public void NewCoordinate_LongitudeGreaterThan180Degrees_ThrowsInvalidCoordinateException()
        {
            var latitude  = 53.339428;
            var longitude = 180.000001;

            var coordinate = new DegreeCoordinate(latitude, longitude);
        }
        public void NewCoordinate_LatitudeLessThanNegative90Degrees_ThrowsInvalidCoordinateException()
        {
            var latitude  = -90.000001;
            var longitude = -6.257664;

            var coordinate = new DegreeCoordinate(latitude, longitude);
        }
        public void NewCoordinate_ValidCoordinate_InstantiatesCorrectly()
        {
            var latitude  = 53.339428;
            var longitude = -6.257664;

            var coordinate = new DegreeCoordinate(latitude, longitude);

            Assert.IsNotNull(coordinate);
            Assert.AreEqual(latitude, coordinate.Latitude);
            Assert.AreEqual(longitude, coordinate.Longitude);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Determines if a customer instance is valid.
        /// </summary>
        /// <returns>True if the customer has a name and a valid location on Earth, else false.</returns>
        public bool IsValid()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(Name))
                {
                    return(false);
                }

                var position = new DegreeCoordinate(Latitude, Longitude);

                return(true);
            }
            catch (InvalidCoordinateException e)
            {
                return(false);
            }
        }