public FlickrPhotoControllerTest() { _mockLocationRepository = new Mock <ILocationRepository>(); _mockFlickrPhotoRepository = new Mock <IFlickrPhotoRepository>(); _FlickrService = new FlickrService(); _FourSquareService = new FourSquareService(); _locations = new List <Location> { new Location { LocationID = "123456", Name = "Cape Town" }, new Location { LocationID = "987654", Name = "Pretoria" }, new Location { LocationID = "101112", Name = "Durban" } }; _flickrPhoto = new List <FlickrPhoto>(); _mockLocationRepository.Setup(x => x.GetAll()).Returns(_locations); _mockLocationRepository.Setup(x => x.GetLocations(It.IsAny <string>())).Returns((string s ) => _locations.Where(x => x.LocationID == s).ToList()); _mockFlickrPhotoRepository.Setup(x => x.GetAll()).Returns(_flickrPhoto); _mockFlickrPhotoRepository.Setup(x => x.GetByLocationId(It.IsAny <string>())).Returns((string s) => _flickrPhoto.Where(x => x.LocationID == s).ToList()); _mockFlickrPhotoRepository.Setup(x => x.AddRange(It.IsAny <List <FlickrPhoto> >())).Callback((List <FlickrPhoto> f) => { _flickrPhoto.AddRange(f); }); mockControllerContext = new Mock <ControllerContext>(); mockSession = new Mock <HttpSessionStateBase>(); mockSession.SetupGet(s => s["LocationId"]).Returns("123"); //somevalue mockControllerContext.Setup(p => p.HttpContext.Session).Returns(mockSession.Object); }
public FlickrPhotoController(ILocationRepository locationRepository, IFlickrPhotoRepository flickrPhotoRepository, IFourSquareService fourSquareService, IFlickrService flickrService) { _LocationRepository = locationRepository; _FlickrPhotoRepository = flickrPhotoRepository; _FourSquareService = fourSquareService; _FlickrService = flickrService; }
public SearchVenuesQueryHandler(IFourSquareService fourSquareService) { this.fourSquareService = fourSquareService; }