示例#1
0
        public void DeleteFromManage_ContainsAcc_ContainsDest_ReturnsRedirectToAction()
        {
            var accessor   = TestHelperLibrary.SetUpHttpContextAccessor();
            var unitOfWork = TestHelperLibrary.SetupUnitOfWork();
            var tempData   = new TempDataDictionary(accessor.Object.HttpContext, Mock.Of <ITempDataProvider>());
            var controller = new VacationController(unitOfWork.Object, accessor.Object);

            controller.TempData = tempData;
            var viewmodel = new ManageViewModel {
                SelectedAccommodationToDelete = 1,
                SelectedActivityToDelete      = 0,
                SelectedDestinationToDelete   = 1
            };
            var result = controller.DeleteFromManage(viewmodel) as RedirectToActionResult;

            Assert.IsType <RedirectToActionResult>(result);
            Assert.Equal("Manage", result.ActionName);
        }