Example #1
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);
            });
        }
Example #2
0
 /// <summary> Setter constructor. </summary>
 public GetMap(GetMapRequest request)
 {
     Request  = request;
     Response = new GetMapResponse();
 }
Example #3
0
 /// <summary> Empty constructor. </summary>
 public GetMap()
 {
     Request  = GetMapRequest.Singleton;
     Response = new GetMapResponse();
 }