Beispiel #1
0
        public async Task GetFollowers_Valid_Test(int id)
        {
            _cityService.Setup(c => c.GetCityFollowersAsync(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.GetFollowers(id);

            _mapper.Verify(m => m.Map <CityProfileDTO, CityViewModel>(It.IsAny <CityProfileDTO>()));
            Assert.NotNull(result);
            Assert.IsInstanceOf <OkObjectResult>(result);
        }
Beispiel #2
0
        public async Task GetFollowers_Invalid_Test(int id)
        {
            // Arrange
            _cityService
            .Setup(c => c.GetCityFollowersAsync(It.IsAny <int>()))
            .ReturnsAsync(() => null);
            _mapper
            .Setup(m => m.Map <CityProfileDTO, CityViewModel>(It.IsAny <CityProfileDTO>()))
            .Returns(new CityViewModel());
            CitiesController citycon = CreateCityController;

            // Act
            var result = await citycon.GetFollowers(id);

            // Assert
            Assert.NotNull(result);
            Assert.IsInstanceOf <NotFoundResult>(result);
        }