Exemplo n.º 1
0
        public async Task <IHttpActionResult> EditVacationPage(VacationPageViewModel vacationPageViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var userAndOrg      = GetUserAndOrganization();
            var vacationPageDto = _mapper.Map <VacationPageViewModel, VacationPageDto>(vacationPageViewModel);

            await _vacationPageService.EditVacationPage(userAndOrg, vacationPageDto);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task EditVacationPage_Should_Return_Ok()
        {
            // Arrange
            _vacationPageService.EditVacationPage(Arg.Any <UserAndOrganizationDto>(), Arg.Any <VacationPageDto>())
            .Returns(Task.CompletedTask);

            var vacationPageViewModel = new VacationPageViewModel
            {
                Content = "test"
            };

            // Act
            _vacationPageController.Validate(vacationPageViewModel);

            var httpActionResult = await _vacationPageController.EditVacationPage(vacationPageViewModel);

            var response = await httpActionResult.ExecuteAsync(CancellationToken.None);

            // Assert
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }