TestWmsCapabilityParser.cs
上传用户:sex100000
上传日期:2013-11-09
资源大小:1377k
文件大小:2k
源码类别:

GIS编程

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using NUnit.Framework;
  5. namespace UnitTests
  6. {
  7. [TestFixture]
  8. public class TestWmsCapabilityParser
  9. {
  10. [Test]
  11. public void Test130()
  12. {
  13. SharpMap.Web.Wms.Client c = new SharpMap.Web.Wms.Client("http://wms.iter.dk/example_capabilities_1_3_0.xml");
  14. Assert.AreEqual(3, c.ServiceDescription.Keywords.Length);
  15. Assert.AreEqual("1.3.0", c.WmsVersion);
  16. Assert.AreEqual("http://hostname/path?", c.GetMapRequests[0].OnlineResource);
  17. Assert.AreEqual("image/gif", c.GetMapOutputFormats[0]);
  18. Assert.AreEqual(4, c.Layer.ChildLayers.Length);
  19. }
  20. [Test]
  21. public void TestDemisv111()
  22. {
  23. SharpMap.Web.Wms.Client c = new SharpMap.Web.Wms.Client("http://www2.demis.nl/mapserver/request.asp");
  24. Assert.AreEqual("World Map", c.ServiceDescription.Title);
  25. Assert.AreEqual("1.1.1", c.WmsVersion);
  26. Assert.AreEqual("http://www2.demis.nl/wms/wms.asp?wms=WorldMap&", c.GetMapRequests[0].OnlineResource);
  27. Assert.AreEqual("image/png", c.GetMapOutputFormats[0]);
  28. Assert.AreEqual(20, c.Layer.ChildLayers.Length);
  29. }
  30. [Test]
  31. public void AddLayerOK()
  32. {
  33. SharpMap.Layers.WmsLayer layer = new SharpMap.Layers.WmsLayer("wms", "http://wms.iter.dk/example_capabilities_1_3_0.xml");
  34. layer.AddLayer("ROADS_1M");
  35. }
  36. [Test]
  37. [ExpectedException(typeof(ArgumentException))]
  38. public void AddLayerFail()
  39. {
  40. SharpMap.Layers.WmsLayer layer = new SharpMap.Layers.WmsLayer("wms", "http://wms.iter.dk/example_capabilities_1_3_0.xml");
  41. layer.AddLayer("NonExistingLayer");
  42. }
  43. }
  44. }