예제 #1
0
        public void bgcolor_html_known_name()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks,tiger_roads,poi");
                Expect.Call(req.GetParam("STYLES")).Return("");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:4326");
                Expect.Call(req.GetParam("BBOX")).Return("40.68,-74.02,40.69,-74.01");
                Expect.Call(req.GetParam("WIDTH")).Return("256");
                Expect.Call(req.GetParam("HEIGHT")).Return("256");
                Expect.Call(req.GetParam("FORMAT")).Return("image/png");
                Expect.Call(req.GetParam("CQL_FILTER")).Return(null);
                Expect.Call(req.GetParam("TRANSPARENT")).Return("FALSE");
                Expect.Call(req.GetParam("BGCOLOR")).Return("lightgrey");
            })
            .Verify(() =>
            {
                IHandler handler      = new GetMap(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetMapResponse>(resp);
            });
        }
예제 #2
0
        public void bbox_must_be_valid()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks");
                Expect.Call(req.GetParam("STYLES")).Return("");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:4326");
                Expect.Call(req.GetParam("BBOX")).Return("45,75,35,65");     // min-max flipped!
                Expect.Call(req.GetParam("WIDTH")).Return("256");
                Expect.Call(req.GetParam("HEIGHT")).Return("256");
                Expect.Call(req.GetParam("FORMAT")).Return("image/png");
                Expect.Call(req.GetParam("CQL_FILTER")).Return(null);
                Expect.Call(req.GetParam("TRANSPARENT")).Return("TRUE");
            })
            .Verify(() =>
            {
                IHandler handler      = new GetMap(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
            });
        }
예제 #3
0
        public void request_generates_transparent_image()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks,tiger_roads,poi");
                Expect.Call(req.GetParam("STYLES")).Return("");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:4326");
                Expect.Call(req.GetParam("BBOX")).Return("40.68,-74.02,40.69,-74.01");
                Expect.Call(req.GetParam("WIDTH")).Return("256");
                Expect.Call(req.GetParam("HEIGHT")).Return("256");
                Expect.Call(req.GetParam("FORMAT")).Return("image/png");
                Expect.Call(req.GetParam("CQL_FILTER")).Return(null);
                Expect.Call(req.GetParam("TRANSPARENT")).Return("TRUE");
                DoNotExpect.Call(req.GetParam("BGCOLOR"));
            })
            .Verify(() =>
            {
                IHandler handler      = new GetMap(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetMapResponse>(resp);
                GetMapResponse img   = (GetMapResponse)resp;
                ImageCodecInfo codec = img.CodecInfo;
                Assert.That(codec, Is.Not.Null);
                Assert.That(codec.MimeType, Is.EqualTo("image/png"));
                Assert.That(img.Image, Is.Not.Null);
            });
        }
예제 #4
0
 /// <inheritdoc />
 public AccountsController(IHandlerResponse responseHandler,
                           ILoginServices loginServices,
                           ITokenBusiness tokenBusiness, IMenuServices menuServices)
     : base(responseHandler, tokenBusiness)
 {
     _loginServices = loginServices;
     _menuServices  = menuServices;
 }
예제 #5
0
        public void request_generates_valid_json()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks,tiger_roads,poi");
                Expect.Call(req.GetParam("STYLES")).Return("");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:4326");
                Expect.Call(req.GetParam("BBOX")).Return("40.68,-74.02,40.69,-74.01");
                Expect.Call(req.GetParam("WIDTH")).Return("256");
                Expect.Call(req.GetParam("HEIGHT")).Return("256");
                Expect.Call(req.GetParam("FORMAT")).Return("image/png");
                Expect.Call(req.GetParam("CQL_FILTER")).Return(null);
                Expect.Call(req.GetParam("QUERY_LAYERS")).Return("poly_landmarks");
                Expect.Call(req.GetParam("INFO_FORMAT")).Return("text/json");
                Expect.Call(req.GetParam("X")).Return(null);
                Expect.Call(req.GetParam("I")).Return("128");
                Expect.Call(req.GetParam("Y")).Return(null);
                Expect.Call(req.GetParam("J")).Return("128");
                Expect.Call(req.GetParam("FEATURE_COUNT")).Return("10");
            })
            .Verify(() =>
            {
                IHandler handler      = new GetFeatureInfoJson(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetFeatureInfoResponseJson>(resp);
                GetFeatureInfoResponseJson json = (GetFeatureInfoResponseJson)resp;
                string contentType = json.ContentType;
                Assert.That(contentType, Is.Not.Null);
                Assert.That(contentType, Is.EqualTo("text/json"));
                string charset = json.Charset;
                Assert.That(charset, Is.Not.Null);
                Assert.That(charset, Is.EqualTo("utf-8"));

                JContainer c = (JContainer)JsonConvert.DeserializeObject(json.Response);
                JToken token = c.First;
                Assert.That(token, Is.InstanceOf <JProperty>());
                JProperty type = (JProperty)token;
                Assert.That(type.Name, Is.EqualTo("type"));
                Assert.That(type.Value.Value <string>(), Is.EqualTo("FeatureCollection"));
                token = token.Next;
                Assert.That(token, Is.InstanceOf <JProperty>());
                JProperty features = (JProperty)token;
                Assert.That(features.Name, Is.EqualTo("features"));
                Assert.That(features.Value, Is.InstanceOf <JArray>());
            });
        }
예제 #6
0
        private IActionResult GenerateActionResult(IHandlerResponse response)
        {
            switch (response)
            {
            case var r when r == null: throw new InvalidOperationException("Request was processed but didn't produce a response.");

            case var r when r.GetErrors().Any(): return(BadRequest(r.GetErrors()));

            case var r when r.FoundResult(): return(Ok(r));

            default: return(NotFound());
            }
        }
예제 #7
0
        public void only_wms_130_is_supported()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() => Expect.Call(req.GetParam("VERSION")).Return("1.1.1"))
            .Verify(() =>
            {
                IHandler handler      = new GetMap(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetMapResponse>(resp);
            });
        }
예제 #8
0
        public void no_queryable_layer()
        {
            const string expectedPlain = "GetFeatureInfo results:\nSearch returned no results on layer: poly_landmarks\n";

            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks,tiger_roads,poi");
                Expect.Call(req.GetParam("STYLES")).Return("");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:4326");
                Expect.Call(req.GetParam("BBOX")).Return("40.689903,-74.02474,40.724235,-73.98955");
                Expect.Call(req.GetParam("WIDTH")).Return("800");
                Expect.Call(req.GetParam("HEIGHT")).Return("820");
                Expect.Call(req.GetParam("FORMAT")).Return("image/png");
                Expect.Call(req.GetParam("CQL_FILTER")).Return(null);
                Expect.Call(req.GetParam("QUERY_LAYERS")).Return("poly_landmarks");
                Expect.Call(req.GetParam("INFO_FORMAT")).Return("text/plain");
                Expect.Call(req.GetParam("X")).Return(null);
                Expect.Call(req.GetParam("I")).Return("378");
                Expect.Call(req.GetParam("Y")).Return(null);
                Expect.Call(req.GetParam("J")).Return("288");
                Expect.Call(req.GetParam("FEATURE_COUNT")).Return("10");
            })
            .Verify(() =>
            {
                foreach (ILayer layer in Map.Layers)
                {
                    ((VectorLayer)layer).IsQueryEnabled = false;
                }

                IHandler handler      = new GetFeatureInfoPlain(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetFeatureInfoResponsePlain>(resp);
                GetFeatureInfoResponsePlain plain = (GetFeatureInfoResponsePlain)resp;
                string contentType = plain.ContentType;
                Assert.That(contentType, Is.Not.Null);
                Assert.That(contentType, Is.EqualTo("text/plain"));
                string charset = plain.Charset;
                Assert.That(charset, Is.Not.Null);
                Assert.That(charset, Is.EqualTo("utf-8"));
                Assert.That(plain.Response, Is.EqualTo(expectedPlain));
            });
        }
예제 #9
0
        public void no_queryable_layer()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks,tiger_roads,poi");
                Expect.Call(req.GetParam("STYLES")).Return("");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:4326");
                Expect.Call(req.GetParam("BBOX")).Return("40.68,-74.02,40.69,-74.01");
                Expect.Call(req.GetParam("WIDTH")).Return("256");
                Expect.Call(req.GetParam("HEIGHT")).Return("256");
                Expect.Call(req.GetParam("FORMAT")).Return("image/png");
                Expect.Call(req.GetParam("CQL_FILTER")).Return(null);
                Expect.Call(req.GetParam("QUERY_LAYERS")).Return("poly_landmarks");
                Expect.Call(req.GetParam("INFO_FORMAT")).Return("text/json");
                Expect.Call(req.GetParam("X")).Return(null);
                Expect.Call(req.GetParam("I")).Return("128");
                Expect.Call(req.GetParam("Y")).Return(null);
                Expect.Call(req.GetParam("J")).Return("128");
                Expect.Call(req.GetParam("FEATURE_COUNT")).Return("10");
            })
            .Verify(() =>
            {
                foreach (ILayer layer in Map.Layers)
                {
                    ((VectorLayer)layer).IsQueryEnabled = false;
                }

                IHandler handler      = new GetFeatureInfoJson(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetFeatureInfoResponseJson>(resp);
                GetFeatureInfoResponseJson json = (GetFeatureInfoResponseJson)resp;
                string contentType = json.ContentType;
                Assert.That(contentType, Is.Not.Null);
                Assert.That(contentType, Is.EqualTo("text/json"));
                string charset = json.Charset;
                Assert.That(charset, Is.Not.Null);
                Assert.That(charset, Is.EqualTo("utf-8"));
                Assert.That(json.Response, Is.EqualTo("{\"type\":\"FeatureCollection\",\"features\":[]}"));
            });
        }
예제 #10
0
        public void service_param_is_mandatory()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("SERVICE")).Return(null);
            })
            .Verify(() =>
            {
                IHandler handler      = new GetCapabilities(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
            });
        }
예제 #11
0
        public void request_generates_valid_plain()
        {
            const string expectedPlain = "GetFeatureInfo results:\nLayer: \'poly_landmarks\'\nFeatureinfo:\n\'52\' \'76\' \'D65\' \'City Hall\',\n\'47\' \'69\' \'H11\' \'Hudson River\'\n";

            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks,tiger_roads,poi");
                Expect.Call(req.GetParam("STYLES")).Return("");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:4326");
                Expect.Call(req.GetParam("BBOX")).Return("40.689903,-74.02474,40.724235,-73.98955");
                Expect.Call(req.GetParam("WIDTH")).Return("800");
                Expect.Call(req.GetParam("HEIGHT")).Return("820");
                Expect.Call(req.GetParam("FORMAT")).Return("image/png");
                Expect.Call(req.GetParam("CQL_FILTER")).Return(null);
                Expect.Call(req.GetParam("QUERY_LAYERS")).Return("poly_landmarks");
                Expect.Call(req.GetParam("INFO_FORMAT")).Return("text/plain");
                Expect.Call(req.GetParam("X")).Return(null);
                Expect.Call(req.GetParam("I")).Return("378");
                Expect.Call(req.GetParam("Y")).Return(null);
                Expect.Call(req.GetParam("J")).Return("288");
                Expect.Call(req.GetParam("FEATURE_COUNT")).Return("10");
            })
            .Verify(() =>
            {
                IHandler handler      = new GetFeatureInfoPlain(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetFeatureInfoResponsePlain>(resp);
                GetFeatureInfoResponsePlain plain = (GetFeatureInfoResponsePlain)resp;
                string contentType = plain.ContentType;
                Assert.That(contentType, Is.Not.Null);
                Assert.That(contentType, Is.EqualTo("text/plain"));
                string charset = plain.Charset;
                Assert.That(charset, Is.Not.Null);
                Assert.That(charset, Is.EqualTo("utf-8"));
                Assert.That(plain.Response, Is.EqualTo(expectedPlain));
            });
        }
예제 #12
0
        public void crs_support_is_checked()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks");
                Expect.Call(req.GetParam("STYLES")).Return("WMS");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:900913");
            })
            .Verify(() =>
            {
                IHandler handler      = new GetMap(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetMapResponse>(resp);
            });
        }
예제 #13
0
        public void version_param_is_optional()
        {
            MockRepository  mocks = new MockRepository();
            IContextRequest req   = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return(null);
                Expect.Call(req.GetParam("SERVICE")).Return("WMS");
                Expect.Call(req.Url).Return(new Uri(Desc.OnlineResource)).Repeat.AtLeastOnce();
                Expect.Call(req.Encode(Desc.OnlineResource)).Return(Desc.OnlineResource);
            })
            .Verify(() =>
            {
                IHandler handler      = new GetCapabilities(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetCapabilitiesResponse>(resp);
                Validate((GetCapabilitiesResponse)resp);
            });
        }
예제 #14
0
 /// <inheritdoc />
 public RoleController(IHandlerResponse responseHandler, ITokenBusiness tokenBusiness, IRoleServices roleServices) : base(responseHandler, tokenBusiness)
 {
     _roleServices = roleServices;
 }
예제 #15
0
 /// <inheritdoc />
 public BaseMainController(IHandlerResponse responseHandler)
 {
     ResponseHandler = responseHandler;
 }
예제 #16
0
 /// <inheritdoc />
 public UserController(IHandlerResponse responseHandler, ITokenBusiness tokenBusiness, IUserServices userServices) : base(responseHandler, tokenBusiness)
 {
     _userServices = userServices;
 }
예제 #17
0
 /// <inheritdoc />
 public PageController(IHandlerResponse responseHandler, ITokenBusiness tokenBusiness, IMenuServices menuServices) : base(responseHandler, tokenBusiness)
 {
     _menuServices = menuServices;
 }
예제 #18
0
 public CreateBroadcastersHandler(IBroadcastersRepository broadcastersRepository, IHandlerResponse handlerResponse)
 {
     _broadcastersRepository = broadcastersRepository;
     _handlerResponse        = handlerResponse;
 }
예제 #19
0
 /// <inheritdoc />
 public BaseMainController(IHandlerResponse responseHandler, ITokenBusiness tokenBusiness)
 {
     ResponseHandler = responseHandler;
     TokenBusiness   = tokenBusiness;
 }
예제 #20
0
파일: WmsServer.cs 프로젝트: cugkgq/Project
        /// <summary>
        /// Generates a WMS 1.3.0 compliant response based on a <see cref="SharpMap.Map"/> and the current HttpRequest.
        /// </summary>
        /// <remarks>
        /// <para>
        /// The Web Map Server implementation in SharpMap requires v1.3.0 compatible clients,
        /// and support the basic operations "GetCapabilities" and "GetMap"
        /// as required by the WMS v1.3.0 specification. SharpMap does not support the optional
        /// GetFeatureInfo operation for querying.
        /// </para>
        /// <example>
        /// Creating a WMS server in ASP.NET is very simple using the classes in the SharpMap.Web.Wms namespace.
        /// <code lang="C#">
        /// void page_load(object o, EventArgs e)
        /// {
        ///		//Get the path of this page
        ///		string url = (Request.Url.Query.Length>0?Request.Url.AbsoluteUri.Replace(Request.Url.Query,""):Request.Url.AbsoluteUri);
        ///		SharpMap.Web.Wms.Capabilities.WmsServiceDescription description =
        ///			new SharpMap.Web.Wms.Capabilities.WmsServiceDescription("Acme Corp. Map Server", url);
        ///
        ///		// The following service descriptions below are not strictly required by the WMS specification.
        ///
        ///		// Narrative description and keywords providing additional information
        ///		description.Abstract = "Map Server maintained by Acme Corporation. Contact: [email protected]. High-quality maps showing roadrunner nests and possible ambush locations.";
        ///		description.Keywords.Add("bird");
        ///		description.Keywords.Add("roadrunner");
        ///		description.Keywords.Add("ambush");
        ///
        ///		//Contact information
        ///		description.ContactInformation.PersonPrimary.Person = "John Doe";
        ///		description.ContactInformation.PersonPrimary.Organisation = "Acme Inc";
        ///		description.ContactInformation.Address.AddressType = "postal";
        ///		description.ContactInformation.Address.Country = "Neverland";
        ///		description.ContactInformation.VoiceTelephone = "1-800-WE DO MAPS";
        ///		//Impose WMS constraints
        ///		description.MaxWidth = 1000; //Set image request size width
        ///		description.MaxHeight = 500; //Set image request size height
        ///
        ///		//Call method that sets up the map
        ///		//We just add a dummy-size, since the wms requests will set the image-size
        ///		SharpMap.Map myMap = MapHelper.InitializeMap(new System.Drawing.Size(1,1));
        ///
        ///		//Parse the request and create a response
        ///		SharpMap.Web.Wms.WmsServer.ParseQueryString(myMap,description);
        /// }
        /// </code>
        /// </example>
        /// </remarks>
        /// <param name="map">Map to serve on WMS</param>
        /// <param name="description">Description of map service</param>
        /// <param name="context">The context the <see cref="WmsServer"/> is running in.</param>
        public static void ParseQueryString(Map map, Capabilities.WmsServiceDescription description, IContext context)
        {
            const StringComparison @case    = StringComparison.InvariantCultureIgnoreCase;
            IContextRequest        request  = context.Request;
            IContextResponse       response = context.Response;

            try
            {
                if (PixelSensitivity < 0)
                {
                    PixelSensitivity = 1;
                }
                if (map == null)
                {
                    throw new WmsArgumentException("Map for WMS is null");
                }
                if (map.Layers.Count == 0)
                {
                    throw new WmsArgumentException("Map doesn't contain any layers for WMS service");
                }

                string req = request.GetParam("REQUEST");
                if (req == null)
                {
                    throw new WmsParameterNotSpecifiedException("REQUEST");
                }

                IHandler handler;
                if (String.Equals(req, "GetCapabilities", @case))
                {
                    handler = new GetCapabilities(description);
                }
                else if (String.Equals(req, "GetFeatureInfo", @case))
                {
                    // use text/plain as default handler
                    // let the default handler validate params
                    string format = request.GetParam("INFO_FORMAT") ?? String.Empty;
                    GetFeatureInfoParams @params = new GetFeatureInfoParams(PixelSensitivity,
                                                                            IntersectDelegate, FeatureInfoResponseEncoding);
                    if (String.Equals(format, "text/json", @case))
                    {
                        handler = new GetFeatureInfoJson(description, @params);
                    }
                    else if (String.Equals(format, "text/html", @case))
                    {
                        handler = new GetFeatureInfoHtml(description, @params);
                    }
                    else
                    {
                        handler = new GetFeatureInfoPlain(description, @params);
                    }
                }
                else if (String.Equals(req, "GetMap", @case))
                {
                    handler = new GetMap(description);
                }
                else
                {
                    string s = String.Format("Invalid request: {0}", req);
                    throw new WmsOperationNotSupportedException(s);
                }

                IHandlerResponse result = handler.Handle(map, request);
                result.WriteToContextAndFlush(response);
            }
            catch (WmsExceptionBase ex)
            {
                ex.WriteToContextAndFlush(response);
            }
        }
 public UpdateAudienceHandler(IAudienceRepository audienceRepository, IHandlerResponse handlerResponse)
 {
     _audienceRepository = audienceRepository;
     _handlerResponse    = handlerResponse;
 }
예제 #22
0
        public void request_generates_valid_html()
        {
            const string    expectedHtml = @"<html>
<head>
<title>GetFeatureInfo output</title>
</head>
<style type='text/css'>
  table.featureInfo, table.featureInfo td, table.featureInfo th {
  border:1px solid #ddd;
  border-collapse:collapse;
  margin:0;
  padding:0;
  font-size: 90%;
  padding:.2em .1em;
}
table.featureInfo th {
  padding:.2em .2em;
  font-weight:bold;
  background:#eee;
}
table.featureInfo td {
  background:#fff;
}
table.featureInfo tr.odd td {
  background:#eee;
}
table.featureInfo caption {
  text-align:left;
  font-size:100%;
  font-weight:bold;
  padding:.2em .2em;
}
</style>
<body>
<table class='featureInfo'>
<caption class='featureInfo'>poly_landmarks</caption>
<tr>
<th>Oid</th>
<th>LAND</th>
<th>CFCC</th>
<th>LANAME</th>
</tr>
<tr class='even'>
<td>52</td>
<td>76</td>
<td>D65</td>
<td>City Hall</td>
</tr>
<tr class='odd'>
<td>47</td>
<td>69</td>
<td>H11</td>
<td>Hudson River</td>
</tr>
</table>
<br />
<table class='featureInfo'>
<caption class='featureInfo'>tiger_roads</caption>
<tr>
<th>Oid</th>
<th>CFCC</th>
<th>NAME</th>
</tr>
<tr class='even'>
<td>7664</td>
<td>A41</td>
<td>Broadway</td>
</tr>
<tr class='odd'>
<td>7667</td>
<td>A41</td>
<td>Broadway</td>
</tr>
<tr class='even'>
<td>6016</td>
<td>A41</td>
<td>Barclay St</td>
</tr>
</table>
<br />

</body>
</html>";
            MockRepository  mocks        = new MockRepository();
            IContextRequest req          = mocks.StrictMock <IContextRequest>();

            With.Mocks(mocks)
            .Expecting(() =>
            {
                Expect.Call(req.GetParam("VERSION")).Return("1.3.0");
                Expect.Call(req.GetParam("LAYERS")).Return("poly_landmarks,tiger_roads,poi");
                Expect.Call(req.GetParam("STYLES")).Return("");
                Expect.Call(req.GetParam("CRS")).Return("EPSG:4326");
                Expect.Call(req.GetParam("BBOX")).Return("40.689903,-74.02474,40.724235,-73.98955");
                Expect.Call(req.GetParam("WIDTH")).Return("800");
                Expect.Call(req.GetParam("HEIGHT")).Return("820");
                Expect.Call(req.GetParam("FORMAT")).Return("image/png");
                Expect.Call(req.GetParam("CQL_FILTER")).Return(null);
                Expect.Call(req.GetParam("QUERY_LAYERS")).Return("poly_landmarks,tiger_roads,poi");
                Expect.Call(req.GetParam("INFO_FORMAT")).Return("text/html");
                Expect.Call(req.GetParam("X")).Return(null);
                Expect.Call(req.GetParam("I")).Return("378");
                Expect.Call(req.GetParam("Y")).Return(null);
                Expect.Call(req.GetParam("J")).Return("288");
                Expect.Call(req.GetParam("FEATURE_COUNT")).Return("10");
            })
            .Verify(() =>
            {
                IHandler handler      = new GetFeatureInfoHtml(Desc);
                IHandlerResponse resp = handler.Handle(Map, req);
                Assert.That(resp, Is.Not.Null);
                Assert.IsInstanceOf <GetFeatureInfoResponseHtml>(resp);
                GetFeatureInfoResponseHtml html = (GetFeatureInfoResponseHtml)resp;
                string contentType = html.ContentType;
                Assert.That(contentType, Is.Not.Null);
                Assert.That(contentType, Is.EqualTo("text/html"));
                string charset = html.Charset;
                Assert.That(charset, Is.Not.Null);
                Assert.That(charset, Is.EqualTo("utf-8"));
                string actual   = html.Response;
                string expected = expectedHtml.Replace(Environment.NewLine, new String('\n', 1));
                Assert.That(actual, Is.EqualTo(expected));
            });
        }