public void GetFlickrPhotoByCoordinate() { FlickrPhotoController controller = new FlickrPhotoController(_mockLocationRepository.Object, _mockFlickrPhotoRepository.Object, _FourSquareService, _FlickrService); controller.ControllerContext = mockControllerContext.Object; controller.GetFlickrPhotoByCoordinate(18.4173774719238, -33.9281208675072, "123456"); var photo = _mockFlickrPhotoRepository.Object.GetByLocationId("123456"); Assert.AreEqual(true, photo.Any()); }
public void GetFlickrPhotoInvalidCoordinate() { FlickrPhotoController controller = new FlickrPhotoController(_mockLocationRepository.Object, _mockFlickrPhotoRepository.Object, _FourSquareService, _FlickrService); controller.ControllerContext = mockControllerContext.Object; try { controller.GetFlickrPhotoByCoordinate(181, 89, "123456"); Assert.Fail("An Exception should have been thrown"); } catch (Exception ex) { Assert.AreEqual("Not a valid longitude (999)", ex.Message); } }