public void SetUp() { _approvalService = new Mock <IApprovalService>(); _documentService = new Mock <IDocumentService>(); _logger = new Mock <ILogger>(); _approvalController = new ApprovalController(_approvalService.Object, _documentService.Object, _logger.Object); _approveDocumentsViewModel = new ApproveDocumentsViewModel { ApproveDocumentViewModel = new List <ApproveDocumentViewModel> { new ApproveDocumentViewModel { DocumentId = "guid1", Selected = true }, new ApproveDocumentViewModel { DocumentId = "guid2", Selected = false } }, Grid = "grid", Page = "1" }; SetControllerContext(_approvalController); MockHttpContext.SetupGet(x => x.Session["CartId"]).Returns("testUser"); MockHttpContext.SetupGet(x => x.User.Identity.Name).Returns("testUser"); MockHttpContext.SetupGet(x => x.Session["testUser"]).Returns("testUser"); }
public ActionResult Basket(ApproveDocumentsViewModel approveDocumentsViewModel) { var documentsAlreadyApproved = new List <string>(); var documentsApproved = new List <string>(); var documentsAlreadyRejcted = new List <string>(); foreach (var document in approveDocumentsViewModel.ApproveDocumentViewModel) { ApproveDocument(document.DocumentId, document.ManCo, document.DocType, document.SubDocType, documentsAlreadyApproved, documentsApproved, documentsAlreadyRejcted); } var documentWarningsViewModel = new DocumentWarningsViewModel { DocumentsAlreadyApproved = string.Join(",", documentsAlreadyApproved.ToArray()), DocumentsAlreadyRejected = string.Join(",", documentsAlreadyRejcted.ToArray()), DocumentsApproved = documentsApproved.Count }; return(PartialView("_DocumentWarnings", documentWarningsViewModel)); }