Esempio n. 1
0
        public void DecodeBase64Test()
        {
            // double delta = 0.0001;

            var decoder = new CircleLocationDecoder();

            // test null arguments.
            Assert.Catch <ArgumentNullException>(() => {
                decoder.Decode(null);
            });

            // test invalid arguments.
            Assert.Catch <FormatException>(() =>
            {
                decoder.Decode("InvalidCode");
            });
        }
Esempio n. 2
0
        public void DecodeBase64Test()
        {
            double delta = 0.0001;

            // define a base64 string.
            string stringData = "AwRbYyNGu6o=";

            // decode.
            var decoder = new CircleLocationDecoder();

            Assert.IsTrue(decoder.CanDecode(stringData));
            var location = decoder.Decode(stringData);

            Assert.IsNotNull(location);
            Assert.IsInstanceOf <CircleLocation>(location);
            var circleLocation = (location as CircleLocation);

            // check coordinate.
            Assert.IsNotNull(circleLocation.Coordinate);
            Assert.AreEqual(6.12699, circleLocation.Coordinate.Longitude, delta); // 6.12699°
            Assert.AreEqual(49.60728, circleLocation.Coordinate.Latitude, delta); // 49.60728°
            Assert.AreEqual(170, circleLocation.Radius);
        }