Beispiel #1
0
        public void GivenADocumentId_WhenITryToApproveThedocument_AndTheDocumentIsCheckedOut_TheDocumentIsApproved()
        {
            _documentService.Setup(c => c.GetDocument(It.IsAny <string>())).Returns(new Document
            {
                CheckOut = new CheckOut
                {
                    CheckOutBy   = "person",
                    CheckOutDate = DateTime.Now.AddHours(-1)
                }
            });

            _approvalEngine.ApproveDocument(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>());

            _approvalRepository.Verify(s => s.Create(It.IsAny <Approval>()), Times.Once());
        }
Beispiel #2
0
 public void ApproveDocument(string userName, string documentId, string manCo, string docType, string subDocType)
 {
     try
     {
         _approvalEngine.ApproveDocument(userName, documentId, manCo, docType, subDocType);
     }
     catch (DocumentAlreadyApprovedException e)
     {
         throw new DocumentAlreadyApprovedException("Document is already approved");
     }
     catch (DocumentAlreadyRejectedException e)
     {
         throw new DocumentAlreadyRejectedException("Document is already rejected");
     }
     catch (Exception e)
     {
         throw new UnityException(string.Format("Unable to approve document guid {0}", documentId), e);
     }
 }