コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }