Exemplo n.º 1
0
        public void Datum_ConvertToWgsAndStringAndLatLng_TheyShouldAllBeEqual()
        {
            var attempts = 1000;

            while (--attempts != 0)
            {
                var latlng = RandomLatLng();
                //  Create a test position
                var datum = new Terratype.CoordinateSystems.Wgs84.DatumType()
                {
                    Latitude  = latlng.Latitude,
                    Longitude = latlng.Longitude
                };

                var wgs84 = new Terratype.CoordinateSystems.Wgs84(datum);

                var parse = wgs84.ToString();
                wgs84.Parse(parse);

                var parse2 = wgs84.ToString();

                Assert.AreEqual(parse, parse2);

                var compare = wgs84.ToWgs84();
                Assert.AreEqual(datum.Latitude, compare.Latitude, Delta);
                Assert.AreEqual(datum.Longitude, compare.Longitude, Delta);
            }
        }
Exemplo n.º 2
0
        public void StringWithDifferentCulture_ConvertToWgsAndDatumAndLatLng_TheyShouldAllBeEqual()
        {
            foreach (var culture in Cultures)
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
                var attempts = 1000;
                while (--attempts != 0)
                {
                    var latlng = RandomLatLng();
                    //  Create a test position
                    var text = latlng.Latitude.ToString(CultureInfo.InvariantCulture) + "," +
                               latlng.Longitude.ToString(CultureInfo.InvariantCulture);

                    var wgs84 = new Terratype.CoordinateSystems.Wgs84(text);

                    var parse = wgs84.ToString();
                    wgs84.Parse(parse);

                    var parse2 = wgs84.ToString();

                    Assert.AreEqual(parse, parse2);

                    var compare = wgs84.ToWgs84();
                    Assert.AreEqual(latlng.Latitude, compare.Latitude, Delta);
                    Assert.AreEqual(latlng.Longitude, compare.Longitude, Delta);
                }
            }
        }