Пример #1
0
 public void bgcolor_hex_format()
 {
     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("#CFCFCF");
         })
         .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 version_is_mandatory()
 {
     MockRepository mocks = new MockRepository();
     IContextRequest req = mocks.StrictMock<IContextRequest>();
     With.Mocks(mocks)
         .Expecting(() => Expect.Call(req.GetParam("VERSION")).Return(null))
         .Verify(() =>
         {
             IHandler handler = new GetMap(Desc);
             IHandlerResponse resp = handler.Handle(Map, req);
             Assert.That(resp, Is.Not.Null);
             Assert.IsInstanceOf<GetMapResponse>(resp);
         });
 }
Пример #4
0
 public void request_generates_valid_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("FALSE");
             Expect.Call(req.GetParam("BGCOLOR")).Return(null);
         })
         .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);
         });
 }
Пример #5
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);
         });
 }