// POST api/geomarker
        public HttpResponseMessage Post(GeoMarker value)
        {
            if (ModelState.IsValid)
            {
                // Refeactor this to use the IoC container, as soon as I fugure out how it works!
                var service = new GeoMarkerService();
                service.Location = new Location();
                service.WebCamControl = new WebCamControl();
                service.WebCamControl.MyBigBroRepository = service.Location.MyBigBroRepository = _myBigBroRepository;
                service.ProcessGeoMarker(value);

                // Created.
                var response = new HttpResponseMessage(HttpStatusCode.Created);

                // Advise where the new GeoMarker is.
                string uri = Url.Route(null, new { id = value.Id });
                response.Headers.Location = new Uri(Request.RequestUri, uri);

                return response;
            }
            throw new HttpResponseException(HttpStatusCode.BadRequest);
        }
        public void SetUpUnitTestsWebCamService()
        {
            // arrange - setup mock services and repository
            webCamControl = new Mock<IWebCamControl>();
            location = new Mock<ILocation>();
            geoMarker = new Mock<IGeoMarker>();
            webCam1 = new Mock<IWebCam>();
            webCam2 = new Mock<IWebCam>();
            //device1 = new Mock<IDevice>();
            //device2 = new Mock<IDevice>();
            mockRepository = new Mock<IMyBigBroRepository>();

            // arrange - setup geomarkers
            var geoMarker1 = new GeoMarker
            {
                Id = 234,
                XCoord = 2,
                YCoord = 2,
                MarkerDateTime = new DateTime(2014, 01, 01, 10, 10, 00),
                DeviceId = 1
            };
            var geoMarker2 = new GeoMarker
            {
                Id = 12,
                XCoord = 4,
                YCoord = 4,
                MarkerDateTime = new DateTime(2014, 01, 01, 10, 30, 00),
                DeviceId = 1
            };
            var geoMarker3 = new GeoMarker
            {
                Id = 1,
                XCoord = 6,
                YCoord = 6,
                MarkerDateTime = new DateTime(2014, 01, 01, 10, 45, 00),
                DeviceId = 2
            };

            // arrange - setup captured images
            var capturedImage1 = new CapturedImage
            {
                Id = 345,
                WebCamId = 123,
                DateTimeCaptured = new DateTime(2014, 01, 01, 10, 10, 00),
                Url = "http://test.com/1"
            };
            var capturedImage2 = new CapturedImage
            {
                Id = 14,
                WebCamId = 345,
                DateTimeCaptured = new DateTime(2014, 01, 01, 10, 30, 00),
                Url = "http://test.com/2"
            };
            var capturedImage3 = new CapturedImage
            {
                Id = 2,
                WebCamId = 567,
                DateTimeCaptured = new DateTime(2014, 01, 01, 10, 45, 00),
                Url = "http://test.com/3"
            };

            // arrange - setup geomarkers
            var device1 = new Device
            {
                Id = 1,
                DeviceName = "test1"
            };
            var device2 = new Device
            {
                Id = 2,
                DeviceName = "test2"
            };

            // arrange setup the captured images
            var capturedImageGeoMarker = new CapturedImageGeoMarker();
            capturedImageGeoMarker.Id = 789;
            capturedImageGeoMarker.CapturedImageId = capturedImage1.Id;
            capturedImageGeoMarker.GeoMarkerId = geoMarker1.Id;
            var capturedImageGeoMarker2 = new CapturedImageGeoMarker();
            capturedImageGeoMarker2.Id = 222;
            capturedImageGeoMarker2.CapturedImageId = capturedImage2.Id;
            capturedImageGeoMarker2.GeoMarkerId = geoMarker2.Id;
            var capturedImageGeoMarker3 = new CapturedImageGeoMarker();
            capturedImageGeoMarker3.Id = 333;
            capturedImageGeoMarker3.CapturedImageId = capturedImage3.Id;
            capturedImageGeoMarker3.GeoMarkerId = geoMarker3.Id;

            // arrange - setup the mock behaviour
            mockRepository.Setup(x => x.Set<GeoMarker>()).Returns(new List<GeoMarker> { geoMarker1, geoMarker2, geoMarker3 }.AsQueryable());
            mockRepository.Setup(x => x.Set<CapturedImage>()).Returns(new List<CapturedImage> { capturedImage1, capturedImage2, capturedImage3 }.AsQueryable());
            mockRepository.Setup(x => x.Set<CapturedImageGeoMarker>()).Returns(new List<CapturedImageGeoMarker> { capturedImageGeoMarker, capturedImageGeoMarker2, capturedImageGeoMarker3 }.AsQueryable());
            mockRepository.Setup(x => x.Set<Device>()).Returns(new List<Device> { device1, device2 }.AsQueryable());

            // setup service to test
            geoMarkerService = new GeoMarkerService(webCamControl.Object, location.Object, mockRepository.Object);
        }