public void TestRadiusRaw()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey());

            var icao = "EKAH";

            var test = service.Metars.RadiusRaw(icao, 1);

            Assert.AreEqual(0, test.Count);

            test = service.Metars.RadiusRaw(icao, 60);

            Assert.AreEqual(2, test.Count);

            test = service.Metars.RadiusRaw(icao, 60, true);

            Assert.AreEqual(3, test.Count);

            try
            {
                service.Metars.RadiusRaw("", 0);
                Assert.Fail("Empty ICAO must throw exception!");
            }
            catch (ArgumentNullException)
            {
                // Expected!
            }
            catch (Exception)
            {
                Assert.Fail("Empty ICAO must throw argument null exception!");
            }
        }
        public void TestSingleRaw()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey());

            var icao = "EKAH";

            var test = service.Tafs.SingleRaw(icao);

            Assert.AreNotEqual(string.Empty, test);

            test = service.Tafs.SingleRaw("ekah");

            Assert.AreNotEqual(string.Empty, test);

            try
            {
                service.Tafs.SingleRaw("");
                Assert.Fail("Empty ICAO must throw exception!");
            }
            catch (ArgumentNullException)
            {
                // Expected!
            }
            catch (Exception)
            {
                Assert.Fail("Empty ICAO must throw argument null exception!");
            }
        }
        public void TestMultipleRaw()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey());

            var icaoList = new List <string>
            {
                "EKAH",
                "EKRD",
                "EKYT"
            };

            var test = service.Metars.MultipleRaw(icaoList);

            Assert.AreEqual(3, test.Count);

            try
            {
                service.Metars.MultipleRaw(new List <string>());
                Assert.Fail("Empty ICAO list must throw exception!");
            }
            catch (ArgumentException)
            {
                // Expected!
            }
            catch (Exception)
            {
                Assert.Fail("Empty ICAO list must throw argument exception!");
            }
        }
        public void TestSingleDecoded()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey());

            var icao = "EKAH";

            var test = service.Metars.SingleDecoded(icao);

            Assert.AreEqual(icao, test.Icao);

            test = service.Metars.SingleDecoded("ekah");

            Assert.AreEqual(icao, test.Icao);

            try
            {
                service.Metars.SingleDecoded("");
                Assert.Fail("Empty ICAO must throw exception!");
            }
            catch (ArgumentNullException)
            {
                // Expected!
            }
            catch (Exception)
            {
                Assert.Fail("Empty ICAO must throw argument null exception!");
            }
        }
        public void TestLatLonDecoded()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey());

            var test = service.Metars.LatitudeLongitudeDecoded(56.347968, 10.582718);

            Assert.AreEqual("EKAH", test.Icao);
        }
        public void TestLatLonRaw()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey());

            var test = service.Metars.LatitudeLongitudeRaw(56.347968, 10.582718);

            Assert.AreNotEqual(string.Empty, test);
        }
Beispiel #7
0
        public void TestInvalid()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey()); // Making the API key wrong on purpose

            var x = service.Stations.Single("MONKEY_BUSINESS_NOT_VALID");

            Assert.AreEqual(true, x.Error);
            Assert.AreEqual("MONKEY_BUSINESS_NOT_VALID Invalid Station ICAO", x.ErrorText);
        }
Beispiel #8
0
        public void TestLatLonRadius()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey());

            var test = service.Stations.LatitudeLongitudeRadius(56.347968, 10.582718, 5);

            Assert.AreEqual(1, test.Count);

            test = service.Stations.LatitudeLongitudeRadius(56.347968, 10.582718, 25);

            Assert.AreEqual(3, test.Count);
        }
Beispiel #9
0
        public void TestException()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey() + "MONKEY"); // Making the API key wrong on purpose

            try
            {
                service.Stations.Single("EKCH");
                Assert.Fail("API key was accepted even though it was fake!");
            }
            catch (ApiException ei)
            {
                Assert.AreEqual(401, ei.HttpStatusCode);
            }
            catch (Exception)
            {
                Assert.Fail("API key was accepted even though it was fake!");
            }
        }
Beispiel #10
0
        public void TestRadius()
        {
            var service = new CheckWxServices(TestSetup.GetTestApiKey());

            var icao = "EKAH";

            var test = service.Stations.Radius(icao, 1);

            Assert.AreEqual(0, test.Count);

            test = service.Stations.Radius(icao, 25);

            Assert.AreEqual(1, test.Count);

            test = service.Stations.Radius(icao, 25, StationType.Heliport);

            Assert.AreEqual(1, test.Count); // This does not work. Type filtering that is!

            test = service.Stations.Radius(icao, 25, StationType.Airport);

            Assert.AreEqual(1, test.Count);

            try
            {
                service.Stations.Radius("", 0);
                Assert.Fail("Empty ICAO must throw exception!");
            }
            catch (ArgumentNullException)
            {
                // Expected!
            }
            catch (Exception)
            {
                Assert.Fail("Empty ICAO must throw argument null exception!");
            }
        }