Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public async Task GetImageListByMartianSol_Good_Parameters()
        {
            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(RoverPhotos));

            var service = new ImagingServices(
                _loggerImaging.Object,
                marsRepoMock.Object);

            var response = await service.GetImageListByMartianSol("Curiosity", string.Empty, 123, 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);
        }