Exemplo n.º 1
0
        public async Task AddAdmin_Valid_Test()
        {
            // Arrange
            CityAdministrationViewModel admin = new CityAdministrationViewModel();

            _mapper
            .Setup(m => m.Map <CityAdministrationViewModel, CityAdministrationDTO>(It.IsAny <CityAdministrationViewModel>()))
            .Returns(new CityAdministrationDTO()
            {
                AdminType = new BLL.DTO.Admin.AdminTypeDTO()
            });
            _cityParticipantsService
            .Setup(c => c.AddAdministratorAsync(It.IsAny <CityAdministrationDTO>()));
            _logger
            .Setup(l => l.LogInformation(It.IsAny <string>()));
            CitiesController citycon = CreateCityController;

            // Act
            var result = await citycon.AddAdmin(admin);

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