GlobalWeatherTest.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Web service test for WSDL document:
  2. // http://live.capescience.com/wsdl/GlobalWeather.wsdl
  3. using System;
  4. using NUnit.Framework;
  5. using GlobalWeatherTests.Soap;
  6. namespace External.GlobalWeatherTests
  7. {
  8. [TestFixture]
  9. public class GlobalWeatherTest: WebServiceTest
  10. {
  11. // CapeConnect / RPC
  12. [Test]
  13. public void TestStationInfo ()
  14. {
  15. StationInfo si = new StationInfo ();
  16. string[] countries = si.listCountries ();
  17. Assert.IsNotNull (countries);
  18. Assert.AreEqual (215, countries.Length);
  19. Assert.AreEqual ("afghanistan", countries[0]);
  20. Assert.AreEqual ("spain", countries[177]);
  21. Assert.AreEqual ("zimbabwe", countries[214]);
  22. Station[] stations = si.searchByCountry ("spain");
  23. Assert.IsNotNull (stations);
  24. foreach (Station sta in stations)
  25. {
  26. Assert.IsNotNull (sta);
  27. if (sta.icao == "LEBL")
  28. Assert.AreEqual ("Barcelona / Aeropuerto", sta.name);
  29. }
  30. Station[] st = si.searchByCode ("LEBL");
  31. Assert.IsNotNull (st);
  32. Assert.AreEqual (1, st.Length);
  33. Assert.AreEqual ("Barcelona / Aeropuerto", st[0].name);
  34. }
  35. [Test]
  36. public void TestGlobalWeather ()
  37. {
  38. GlobalWeather gw = new GlobalWeather ();
  39. WeatherReport wr = gw.getWeatherReport ("LEBL");
  40. Assert.IsNotNull (wr.station);
  41. Assert.AreEqual ("LEBL", wr.station.icao);
  42. Assert.AreEqual ("Barcelona / Aeropuerto", wr.station.name);
  43. }
  44. }
  45. }