public void TestSerializeWmsLayerWithCredentials()
        {
            SharpMap.Map             m = new SharpMap.Map();
            SharpMap.Layers.WmsLayer l = new SharpMap.Layers.WmsLayer("testwms", "http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer", TimeSpan.MaxValue,
                                                                      System.Net.WebRequest.DefaultWebProxy, new NetworkCredential("test", "pw"));
            l.AddChildLayers(l.RootLayer, false);
            m.Layers.Add(l);
            MemoryStream ms = new MemoryStream();

            SharpMap.Serialization.MapSerialization.SaveMapToStream(m, ms);
            string txt = System.Text.ASCIIEncoding.ASCII.GetString(ms.ToArray());

            System.Diagnostics.Trace.WriteLine(txt);
            Assert.IsTrue(txt.Contains(@"<Layers>
    <MapLayer xsi:type=""WmsLayer"">
      <Name>testwms</Name>
      <MinVisible>0</MinVisible>
      <MaxVisible>1.7976931348623157E+308</MaxVisible>
      <OnlineURL>http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?SERVICE=WMS&amp;REQUEST=GetCapabilities&amp;</OnlineURL>
      <WmsUser>test</WmsUser>
      <WmsPassword>pw</WmsPassword>
      <WmsLayers>0,1,2</WmsLayers>
    </MapLayer>
  </Layers>"));
            ms.Close();
        }
        public void TestSerializeWmsLayer()
        {
            SharpMap.Map             m = new SharpMap.Map();
            SharpMap.Layers.WmsLayer l = new SharpMap.Layers.WmsLayer("testwms", "http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer");
            l.AddChildLayers(l.RootLayer, false);
            m.Layers.Add(l);
            MemoryStream ms = new MemoryStream();

            SharpMap.Serialization.MapSerialization.SaveMapToStream(m, ms);
            string txt = Encoding.ASCII.GetString(ms.ToArray());

            txt = txt.Replace("\r\n", "");
            System.Diagnostics.Trace.WriteLine(txt);
            Assert.IsTrue(txt.Contains(@"<Layers><MapLayer xsi:type=""WmsLayer"">
      <Name>testwms</Name>
      <MinVisible>0</MinVisible>
      <MaxVisible>1.7976931348623157E+308</MaxVisible>
      <OnlineURL>http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?SERVICE=WMS&amp;REQUEST=GetCapabilities&amp;</OnlineURL>
      <WmsLayers>0,1,2</WmsLayers>
    </MapLayer>
  </Layers>"));
            ms.Close();
        }