private ITemplateHandler GetTemplateHandler(DocumentType type) { ITemplateHandler templateHandler; switch (type) { case DocumentType.I9: templateHandler = new I9TemplateHandler(); break; case DocumentType.W4: templateHandler = new W4TemplateHandler(); break; case DocumentType.Offer: templateHandler = new OfferTemplateHandler(); break; case DocumentType.DirectDeposit: templateHandler = new DirectDepositTemplateHandler(); break; case DocumentType.TuitionRbt: templateHandler = new TuitionReimbursementTemplateHandler(); break; default: throw new InvalidOperationException("Document type is not set"); } return(templateHandler); }
public void CreateEnvelope_WhenDocumentTypeI9AndLoginTypeCodeGrant_RequestedEnvelopeTemplateWithIdvNotEnabled( UserDetails userInformation, UserDetails additionalUser) { //Arrange _userService.Setup(x => x.GetUserDetails(_accountId, _userId, _loginType)).Returns(userInformation); _accountsApi.Setup(x => x.GetAccountIdentityVerification(_accountId)).Returns(() => new AccountIdentityVerificationResponse { IdentityVerification = new List <AccountIdentityVerificationWorkflow> { new AccountIdentityVerificationWorkflow(WorkflowId: "100") } }); _docuSignApiProvider.SetupGet(c => c.AccountsApi).Returns(_accountsApi.Object); var sut = new EnvelopeService(_docuSignApiProvider.Object, _userService.Object, SetupConfiguration()); //Act sut.CreateEnvelope(DocumentType.I9, _accountId, _userId, LoginType.CodeGrant, additionalUser, "", ""); //Assert EnvelopeTemplate templateToExpect = new I9TemplateHandler().BuildTemplate("../../../../DocuSign.MyHR/"); templateToExpect.Recipients.Signers.First().IdentityVerification = null; _docuSignApiProvider.Verify(mock => mock.TemplatesApi.CreateTemplate(_accountId, templateToExpect), Times.Once()); }