public async Task GetPhotoManifestByRover_Bad_RoverName() { var marsRepoMock = new Mock <IMarsRepository>(); marsRepoMock.Setup( rmr => rmr.GetPhotoManifestsByRover(It.IsAny <string>())) .Returns(Task.FromResult((PhotoManifest)null)); var service = new ImagingServices( _loggerImaging.Object, marsRepoMock.Object); var response = await service.GetPhotoManifestByRover("Kyle"); Assert.Null(response); }
public async Task GetImageListByMartianSol_Bad_RoverName() { var marsRepoMock = new Mock <IMarsRepository>(); marsRepoMock.Setup( rmr => rmr.GetBySolDate(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>())) .Returns(Task.FromResult((Photos)null)); var service = new ImagingServices( _loggerImaging.Object, marsRepoMock.Object); var response = await service.GetImageListByMartianSol("Bad Robot", string.Empty, 123, 0); Assert.Null(response); }
public async Task GetImageListByEarthDate_Missing_Rover() { var marsRepoMock = new Mock <IMarsRepository>(); marsRepoMock.Setup( rmr => rmr.GetByEarthDate(It.IsAny <string>(), It.IsAny <DateTime>(), It.IsAny <string>(), It.IsAny <int>())) .Returns(Task.FromResult((Photos)null)); var service = new ImagingServices( _loggerImaging.Object, marsRepoMock.Object); var response = await service.GetImageListByEarthDate(string.Empty, string.Empty, new DateTime(2017, 2, 27), 0); Assert.Null(response); }
public async Task GetImageListByEarthDate_Good_Parameters() { var marsRepoMock = new Mock <IMarsRepository>(); marsRepoMock.Setup( rmr => rmr.GetByEarthDate(It.IsAny <string>(), It.IsAny <DateTime>(), It.IsAny <string>(), It.IsAny <int>())) .Returns(Task.FromResult(RoverPhotos)); var service = new ImagingServices( _loggerImaging.Object, marsRepoMock.Object); var response = await service.GetImageListByEarthDate("Curiosity", string.Empty, new DateTime(2017, 2, 27), 0); Assert.Equal(RoverPhotos.photos[0].id, response.photos[0].id); Assert.Equal(RoverPhotos.photos[0].camera.id, response.photos[0].camera.id); Assert.Equal(RoverPhotos.photos[0].rover.id, response.photos[0].rover.id); Assert.Equal(RoverPhotos.photos[0].rover.cameras[0].id, response.photos[0].rover.cameras[0].id); }
public async Task GetPhotoManifestByRover_Good_RoverName() { var marsRepoMock = new Mock <IMarsRepository>(); marsRepoMock.Setup( rmr => rmr.GetPhotoManifestsByRover(It.IsAny <string>())) .Returns(Task.FromResult(PhotoManifestData)); var service = new ImagingServices( _loggerImaging.Object, marsRepoMock.Object); var response = await service.GetPhotoManifestByRover("Curiosity"); Assert.Equal(PhotoManifestData.photo_manifest.name, response.photo_manifest.name); Assert.Equal(PhotoManifestData.photo_manifest.landing_date, response.photo_manifest.landing_date); Assert.Equal(PhotoManifestData.photo_manifest.total_photos, response.photo_manifest.total_photos); Assert.Equal(PhotoManifestData.photo_manifest.photos[0].earth_date, response.photo_manifest.photos[0].earth_date); Assert.Equal(PhotoManifestData.photo_manifest.photos[0].cameras[0], response.photo_manifest.photos[0].cameras[0]); Assert.True(true); }