Beispiel #1
0
        public async Task GetDocumentsInvalidCheck()
        {
            _cityService.Setup(c => c.GetCityDocumentsAsync(It.IsAny <int>()))
            .ReturnsAsync(() => null);

            _mapper.Setup(m => m.Map <CityProfileDTO, CityViewModel>(It.IsAny <CityProfileDTO>()))
            .Returns(new CityViewModel());

            CitiesController citycon = CreateCityController;

            var result = await citycon.GetDocuments(GetFakeID());

            Assert.NotNull(result);
            Assert.IsInstanceOf <NotFoundResult>(result);
        }
Beispiel #2
0
        public async Task GetDocuments_Valid_Test(int id)
        {
            _cityService.Setup(c => c.GetCityDocumentsAsync(It.IsAny <int>()))
            .ReturnsAsync(new CityProfileDTO());

            _mapper.Setup(m => m.Map <CityProfileDTO, CityViewModel>(It.IsAny <CityProfileDTO>()))
            .Returns(new CityViewModel());

            CitiesController citycon = CreateCityController;

            var result = await citycon.GetDocuments(id);


            _mapper.Verify(m => m.Map <CityProfileDTO, CityViewModel>(It.IsAny <CityProfileDTO>()));
            Assert.NotNull(result);
            Assert.IsInstanceOf <OkObjectResult>(result);
        }