public void Arrange()
 {
     _deleteViewModel = new CertificateDeleteViewModel()
     {
         CertificateId   = Certificate.Id,
         IncidentNumber  = "INC123",
         ReasonForChange = "chnage required"
     };
     _sut = new CertificateDeleteController(MockedLogger.Object, MockHttpContextAccessor.Object, ApiClient, CertificateApiClient);
 }
        public async Task <IActionResult> AuditDetails(CertificateDeleteViewModel vm)
        {
            var viewModel =
                await LoadViewModel <CertificateAuditDetailsViewModel>(vm.CertificateId,
                                                                       "~/Views/CertificateDelete/AuditDetails.cshtml");

            var viewResult = (viewModel as ViewResult);

            var certificateAuditDetailsViewModel = viewResult.Model as CertificateAuditDetailsViewModel;

            certificateAuditDetailsViewModel.ReasonForChange   = vm.ReasonForChange;
            certificateAuditDetailsViewModel.IncidentNumber    = vm.IncidentNumber;
            certificateAuditDetailsViewModel.IsDeleteConfirmed = vm.IsDeleteConfirmed;

            return(View(certificateAuditDetailsViewModel));
        }
        public async Task <IActionResult> ConfirmDelete(CertificateDeleteViewModel vm)
        {
            var viewModel =
                await LoadViewModel <CertificateConfirmDeleteViewModel>(vm.CertificateId,
                                                                        "~/Views/CertificateDelete/ConfirmDelete.cshtml");

            var viewResult = (viewModel as ViewResult);
            var username   = ContextAccessor.HttpContext.User.FindFirst("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn")?.Value;
            var certificateConfirmDeleteViewModel = viewResult.Model as CertificateConfirmDeleteViewModel;

            certificateConfirmDeleteViewModel.ReasonForChange   = vm.ReasonForChange;
            certificateConfirmDeleteViewModel.IncidentNumber    = vm.IncidentNumber;
            certificateConfirmDeleteViewModel.Username          = username;
            certificateConfirmDeleteViewModel.IsDeleteConfirmed = vm.IsDeleteConfirmed;
            return(View(certificateConfirmDeleteViewModel));
        }
        public async Task <IActionResult> ConfirmAndSubmit(CertificateDeleteViewModel vm)
        {
            var viewModel =
                await LoadViewModel <CertificateSubmitDeleteViewModel>(vm.CertificateId,
                                                                       "~/Views/CertificateDelete/ConfirmAndSubmit.cshtml");

            var viewResult = (viewModel as ViewResult);
            var certificateDeleteViewModel = viewResult.Model as CertificateSubmitDeleteViewModel;

            certificateDeleteViewModel.Page              = vm.Page;
            certificateDeleteViewModel.SearchString      = vm.SearchString;
            certificateDeleteViewModel.IsDeleteConfirmed = vm.IsDeleteConfirmed;
            certificateDeleteViewModel.IncidentNumber    = vm.IncidentNumber;
            certificateDeleteViewModel.ReasonForChange   = vm.ReasonForChange;

            return(View(certificateDeleteViewModel));
        }