Exemple #1
0
        private void CleanupModel(ApplicationSubmission model)
        {
            // clear out non-selected wage type
            if (model.PayTypeId == ResponseIds.PayType.Hourly)
            {
                model.PieceRateWageInfo = null;
            }
            else if (model.PayTypeId == ResponseIds.PayType.PieceRate)
            {
                model.HourlyWageInfo = null;
            }

            // clear out non-selected prevailing wage method
            CleanupWageTypeInfo(model.HourlyWageInfo);
            CleanupWageTypeInfo(model.PieceRateWageInfo);

            // clear out fields for initial application
            if (model.ApplicationTypeId == ResponseIds.ApplicationType.Initial)
            {
                model.Employer.FiscalQuarterEndDate     = null;
                model.Employer.NumSubminimalWageWorkers = null;
                model.PayTypeId         = null;
                model.HourlyWageInfo    = null;
                model.PieceRateWageInfo = null;
                foreach (var workSite in model.WorkSites)
                {
                    workSite.NumEmployees = null;
                    workSite.Employees    = null;
                }
            }
        }
        public async Task <HttpResponseMessage> Submit([FromBody] ApplicationSubmission submission)
        {
            var results = _applicationSubmissionValidator.Validate(submission);

            if (!results.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, results.Errors));
            }

            _applicationService.ProcessModel(submission);

            // make sure user has rights to the EIN
            var hasEINClaim = _identityService.UserHasEINClaim(User, submission.EIN);

            if (!hasEINClaim)
            {
                return(Request.CreateResponse(HttpStatusCode.Unauthorized));
            }

            await _applicationService.SubmitApplicationAsync(submission);

            // remove the associated application save
            _saveService.Remove(submission.EIN);

            return(Request.CreateResponse(HttpStatusCode.Created));
        }
        /// <summary>
        ///     Given a 14c application and an HTML template string,
        ///     build a populated HTML string
        /// </summary>
        /// <param name="application">
        ///     The 14c application object
        /// </param>
        /// <param name="templateString">
        ///     The HTML template string to populate
        /// </param>
        /// <returns>
        ///     A popualted HTML string
        /// </returns>
        public string GetApplicationFormViewContent(ApplicationSubmission application, string templateString)
        {
            string tempString = string.Empty;

            tempString = ApplicationFormViewHelper.PopulateHtmlTemplateWithApplicationData(application, templateString);
            return(tempString);
        }
Exemple #4
0
        private void SetDefaults(ApplicationSubmission model)
        {
            // set status
            model.Status   = null;
            model.StatusId = StatusIds.Pending;

            // default admin fields
            model.CertificateEffectiveDate  = null;
            model.CertificateExpirationDate = null;
            model.CertificateNumber         = null;

            // default checkboxes
            if (model.Employer != null)
            {
                if (model.Employer.HasParentOrg.GetValueOrDefault())
                {
                    model.Employer.SendMailToParent = model.Employer.SendMailToParent ?? false;
                }
                else
                {
                    model.Employer.SendMailToParent = null;
                }

                // default to false if no value was passed
                model.Employer.HasMailingAddress = model.Employer.HasMailingAddress ?? false;
                if (!model.Employer.HasMailingAddress.GetValueOrDefault())
                {
                    // remove mailing address if hasMailingAddress == false
                    model.Employer.MailingAddress = null;
                }
            }
        }
        /// <summary>
        /// Prepare Email Contents from html template
        /// </summary>
        /// <param name="application">
        /// Application Data
        /// </param>
        /// <param name="htmlString">
        /// Email template string
        /// </param>
        /// <param name="receiver">
        /// Email receiver
        /// </param>
        /// <returns>Key and value pair of the receiver and content</returns>
        public Dictionary <string, EmailContent> PrepareApplicationEmailContents(ApplicationSubmission application, string certificationTeamEmailBodyTemplate, string employerEmailBodyTemplate, EmailReceiver receivers)
        {
            string employerEmailBody          = FillTemplate(application, employerEmailBodyTemplate);
            string certificationTeamEmailBody = FillTemplate(application, certificationTeamEmailBodyTemplate);
            string emailSubject = AppSettings.Get <string>("ApplicationSubmittedEmailSubject");
            var    emails       = new Dictionary <string, EmailContent>();

            if (receivers == EmailReceiver.CertificationTeam || receivers == EmailReceiver.Both)
            {
                emails.Add(Constants.CertificationEmailKey, new EmailContent()
                {
                    Body    = certificationTeamEmailBody,
                    To      = AppSettings.Get <string>("CertificationTeamEmailAddress"),
                    Subject = string.Format("{0} :: {1}", application?.Employer?.PhysicalAddress?.State, emailSubject)
                });
            }
            if (receivers == EmailReceiver.Employer || receivers == EmailReceiver.Both)
            {
                emails.Add(Constants.EmployerEmailKey, new EmailContent()
                {
                    Body    = employerEmailBody,
                    To      = application.ContactEmail,
                    Subject = emailSubject
                });
            }

            return(emails);
        }
Exemple #6
0
 public void Initialize()
 {
     _applicationServiceMock            = new ApplicationServiceMock();
     application                        = _applicationServiceMock.GetApplicationById(new Guid("CE7F5AA5-6832-43FE-BAE1-80D14CD8F666"));
     _emailService                      = new EmailContentService();
     certificationTeamEmailBodyTemplate = @"email body";
     employerEmailBodyTemplate          = @"Employer email body";
 }
        public Task <int> ChangeApplicationStatus(ApplicationSubmission application, int newStatusId)
        {
            var value = Task <int> .Run(() => {
                int num = 1;
                return(num);
            });

            return(value);
        }
        public void ApplicationSubmission_Handles_Null_EstablishmentId()
        {
            // Arrange
            var model = new ApplicationSubmission {
                EstablishmentTypeId = null
            };

            Assert.IsNull(model.EstablishmentType);
        }
        public Task <int> SubmitApplicationAsync(ApplicationSubmission submission)
        {
            var value = Task <int> .Run(() => {
                int num = 1;
                return(num);
            });

            return(value);
        }
        /// <summary>
        /// Get all attachments from an application after the application has been submitted.
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public Dictionary <string, Attachment> GetApplicationAttachments(ref ApplicationSubmission application)
        {
            var attachments           = new Dictionary <string, Attachment>();
            var applicationSubmission = application;

            if (application != null)
            {
                var count = 1;
                if (application.Employer?.SCAAttachments != null)
                {
                    foreach (var item in application.Employer.SCAAttachments)
                    {
                        var attachment = _attachmentRepository.Get().SingleOrDefault(x => x.Id == item.SCAAttachmentId);
                        attachments.Add(string.Format("SCA Wage Determination Attachment {0}", (count++)), attachment);
                    }
                }

                if (application.PieceRateWageInfo?.SCAWageDeterminationAttachmentId != null)
                {
                    var attachmentId = application.PieceRateWageInfo.SCAWageDeterminationAttachmentId;
                    var attachment   = _attachmentRepository.Get().SingleOrDefault(x => x.Id == attachmentId);
                    attachments.Add(string.Format("Piece Rate Wage Info ScaWage Determination Attachment  {0}", (count++)), attachment);
                }

                if (application.PieceRateWageInfo?.AttachmentId != null)
                {
                    var attachmentId = application.PieceRateWageInfo.AttachmentId;
                    var attachment   = _attachmentRepository.Get().SingleOrDefault(x => x.Id == attachmentId);
                    attachments.Add("Piece Rate Wage Info Attachment", attachment);
                }

                if (application.HourlyWageInfo?.SCAWageDeterminationAttachmentId != null)
                {
                    var attachmentId = application.HourlyWageInfo.SCAWageDeterminationAttachmentId;
                    var attachment   = _attachmentRepository.Get().SingleOrDefault(x => x.Id == attachmentId);
                    attachments.Add(string.Format("Hourly Wage Info ScaWage Determination Attachment  {0}", (count++)), attachment);
                }

                if (application.HourlyWageInfo?.MostRecentPrevailingWageSurvey?.AttachmentId != null)
                {
                    var attachmentId = application.HourlyWageInfo.MostRecentPrevailingWageSurvey.AttachmentId;
                    var attachment   = _attachmentRepository.Get().SingleOrDefault(x => x.Id == attachmentId);
                    attachments.Add("Hourly Wage Info SCA Wage Determination Attachment", attachment);
                }

                if (application.HourlyWageInfo?.AttachmentId != null)
                {
                    var attachmentId = application.HourlyWageInfo.AttachmentId;
                    var attachment   = _attachmentRepository.Get().SingleOrDefault(x => x.Id == attachmentId);
                    attachments.Add("Hourly Wage Info Attachmen", attachment);
                }
            }
            return(attachments);
        }
        public void Should_Not_Require_PayTypeId_Initial()
        {
            var model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Initial, PayTypeId = null
            };

            ApplicationSubmissionValidator.ShouldNotHaveValidationErrorFor(x => x.PayTypeId, model);
            model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Renewal, PayTypeId = ResponseIds.PayType.PieceRate
            };
            ApplicationSubmissionValidator.ShouldNotHaveValidationErrorFor(x => x.PayTypeId, model);
        }
        public void Should_Validate_PayType()
        {
            var model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Renewal, PayTypeId = 30
            };

            ApplicationSubmissionValidator.ShouldHaveValidationErrorFor(x => x.PayTypeId, model);
            model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Renewal, PayTypeId = ResponseIds.PayType.PieceRate
            };
            ApplicationSubmissionValidator.ShouldNotHaveValidationErrorFor(x => x.PayTypeId, model);
        }
        public void Should_Require_Employer()
        {
            var model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Initial, Employer = null
            };

            ApplicationSubmissionValidator.ShouldHaveValidationErrorFor(x => x.Employer, model);
            model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Initial, Employer = new EmployerInfo()
            };
            ApplicationSubmissionValidator.ShouldNotHaveValidationErrorFor(x => x.Employer, model);
        }
        public void Should_Require_PreviousCertificateNumber()
        {
            ApplicationSubmissionValidator.ShouldNotHaveValidationErrorFor(x => x.PreviousCertificateNumber, "");
            var model = new ApplicationSubmission {
                HasPreviousCertificate = true, PreviousCertificateNumber = null
            };

            ApplicationSubmissionValidator.ShouldHaveValidationErrorFor(x => x.PreviousCertificateNumber, model);
            model = new ApplicationSubmission {
                HasPreviousCertificate = true, PreviousCertificateNumber = "12345"
            };
            ApplicationSubmissionValidator.ShouldNotHaveValidationErrorFor(x => x.PreviousCertificateNumber, model);
        }
 /// <summary>
 /// Set application submission related object for pdf generation
 /// </summary>
 /// <param name="application">
 /// Application Submission
 /// </param>
 private void LoadApplicationData(ref ApplicationSubmission application)
 {
     // Load WIOAWorker related data
     if (application.WIOA != null && application.WIOA.WIOAWorkers != null)
     {
         var workers = new List <WIOAWorker>();
         foreach (var worker in application.WIOA.WIOAWorkers)
         {
             worker.WIOAWorkerVerified = _responseService.GetResponseById(worker.WIOAWorkerVerifiedId.ToString());
             workers.Add(worker);
         }
         ;
         application.WIOA.WIOAWorkers = workers;
     }
     // Load work site related data
     if (application.WorkSites != null)
     {
         var workSites = new List <WorkSite>();
         foreach (var wSite in application.WorkSites)
         {
             wSite.WorkSiteType = _responseService.GetResponseById(wSite.WorkSiteTypeId.ToString());
             wSite.Employees    = LoadEmployeeData(wSite.Employees);
             workSites.Add(wSite);
         }
         ;
         application.WorkSites = workSites;
     }
     // Load application establishment types related data
     if (application.EstablishmentType != null)
     {
         var applicationSubmissionEstablishmentTypes = new List <ApplicationSubmissionEstablishmentType>();
         foreach (var type in application.EstablishmentType)
         {
             type.EstablishmentType = _responseService.GetResponseById(type.EstablishmentTypeId.ToString());
             applicationSubmissionEstablishmentTypes.Add(type);
         }
         application.EstablishmentType = applicationSubmissionEstablishmentTypes;
     }
     // Load Employer Providing Facilities Deduction types related data
     if (application.Employer != null && application.Employer.ProvidingFacilitiesDeductionType != null)
     {
         var employerInfoProvidingFacilitiesDeductionTypes = new List <EmployerInfoProvidingFacilitiesDeductionType>();
         foreach (var type in application.Employer.ProvidingFacilitiesDeductionType)
         {
             type.ProvidingFacilitiesDeductionType = _responseService.GetResponseById(type.ProvidingFacilitiesDeductionTypeId.ToString());
             employerInfoProvidingFacilitiesDeductionTypes.Add(type);
         }
         application.Employer.ProvidingFacilitiesDeductionType = employerInfoProvidingFacilitiesDeductionTypes;
     }
 }
Exemple #16
0
        public void ApplicationService_Cleans_SendMailToParent()
        {
            // Arrange
            var obj = new ApplicationSubmission {
                Employer = new EmployerInfo {
                    SendMailToParent = true
                }
            };

            // Act
            _applicationService.ProcessModel(obj);

            // Assert
            Assert.IsNull(obj.Employer.SendMailToParent);
        }
Exemple #17
0
        public void ApplicationService_Defaults_SendMailToParent_NotNull()
        {
            // Arrange
            var obj = new ApplicationSubmission {
                Employer = new EmployerInfo {
                    HasParentOrg = true, SendMailToParent = true
                }
            };

            // Act
            _applicationService.ProcessModel(obj);

            // Assert
            Assert.IsTrue(obj.Employer.SendMailToParent.Value);
        }
Exemple #18
0
        public void ApplicationService_CleanupHourlyWageInfo()
        {
            // Arrange
            var obj = new ApplicationSubmission
            {
                PayTypeId      = ResponseIds.PayType.PieceRate,
                HourlyWageInfo = new HourlyWageInfo()
            };

            // Act
            _applicationService.ProcessModel(obj);

            // Assert
            Assert.IsNull(obj.HourlyWageInfo);
        }
Exemple #19
0
        public void ApplicationService_Defaults_HasMailingAddress_NotNull()
        {
            // Arrange
            var obj = new ApplicationSubmission {
                Employer = new EmployerInfo {
                    HasMailingAddress = true
                }
            };

            // Act
            _applicationService.ProcessModel(obj);

            // Assert
            Assert.IsTrue(obj.Employer.HasMailingAddress.Value);
        }
Exemple #20
0
        public void ApplicationService_Sets_PendingStatus()
        {
            // Arrange
            var obj = new ApplicationSubmission
            {
                Status   = new Status(),
                StatusId = StatusIds.Issued // make sure any set status gets overwritten with pending
            };

            // Act
            _applicationService.ProcessModel(obj);

            // Assert
            Assert.IsNull(obj.Status);
            Assert.AreEqual(StatusIds.Pending, obj.StatusId);
        }
Exemple #21
0
        public async Task ApplicationService_Changes_ApplicationStatus()
        {
            // Arrange
            var oldStatusId = 1;
            var newStatusId = 2;
            var application = new ApplicationSubmission {
                StatusId = oldStatusId
            };

            // Act
            await _applicationService.ChangeApplicationStatus(application, newStatusId);

            // Assert
            Assert.AreEqual(application.StatusId, newStatusId);
            _mockRepo.Verify(m => m.ModifyApplication(It.IsAny <ApplicationSubmission>()));
        }
        /// <summary>
        /// Get all attachments from an application after the application has been submitted.
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public List <Attachment> GetApplicationAttachments(ApplicationSubmission application)
        {
            List <Attachment> attachments = new List <Attachment>();

            if (application != null)
            {
                if (application.Employer?.SCAAttachmentId != null)
                {
                    // The attachment is null right after application is submitted.
                    // In order to be able to send application submit email to employer with concatenate pdf document
                    // The attachment need to get from attachment database table directly
                    var attachment = _attachmentRepository.Get()
                                     .SingleOrDefault(x => x.Deleted == false && x.Id == application.Employer?.SCAAttachmentId.ToString());
                    attachments.Add(attachment);
                }

                if (application.PieceRateWageInfo?.SCAWageDeterminationAttachmentId != null)
                {
                    var attachment = _attachmentRepository.Get()
                                     .SingleOrDefault(x => x.Deleted == false && x.Id == application.PieceRateWageInfo?.SCAWageDeterminationAttachmentId.ToString());
                    attachments.Add(application.PieceRateWageInfo.SCAWageDeterminationAttachment);
                }

                if (application.PieceRateWageInfo?.AttachmentId != null)
                {
                    var attachment = _attachmentRepository.Get()
                                     .SingleOrDefault(x => x.Deleted == false && x.Id == application.PieceRateWageInfo?.AttachmentId.ToString());
                    attachments.Add(application.PieceRateWageInfo.Attachment);
                }

                if (application.HourlyWageInfo?.MostRecentPrevailingWageSurvey?.AttachmentId != null)
                {
                    var attachment = _attachmentRepository.Get()
                                     .SingleOrDefault(x => x.Deleted == false && x.Id == application.HourlyWageInfo?.MostRecentPrevailingWageSurvey?.AttachmentId.ToString());
                    attachments.Add(application.HourlyWageInfo.MostRecentPrevailingWageSurvey.Attachment);
                }

                if (application.HourlyWageInfo?.AttachmentId != null)
                {
                    var attachment = _attachmentRepository.Get()
                                     .SingleOrDefault(x => x.Deleted == false && x.Id == application.HourlyWageInfo?.AttachmentId.ToString());
                    attachments.Add(application.HourlyWageInfo.Attachment);
                }
            }
            return(attachments);
        }
Exemple #23
0
        public void ApplicationService_Defaults_AdminFields()
        {
            // Arrange
            var obj = new ApplicationSubmission
            {
                CertificateEffectiveDate  = DateTime.Now,
                CertificateExpirationDate = DateTime.Now,
                CertificateNumber         = "xxxxxxxx"
            };

            // Act
            _applicationService.ProcessModel(obj);

            // Assert
            Assert.IsNull(obj.CertificateEffectiveDate);
            Assert.IsNull(obj.CertificateExpirationDate);
            Assert.IsNull(obj.CertificateNumber);
        }
        public void Should_Require_WorkSites()
        {
            var model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Initial, WorkSites = null
            };

            ApplicationSubmissionValidator.ShouldHaveValidationErrorFor(x => x.WorkSites, model);
            model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Initial, WorkSites = new List <WorkSite>()
            };
            ApplicationSubmissionValidator.ShouldHaveValidationErrorFor(x => x.WorkSites, model);
            model = new ApplicationSubmission {
                ApplicationTypeId = ResponseIds.ApplicationType.Initial, WorkSites = new List <WorkSite> {
                    new WorkSite()
                }
            };
            ApplicationSubmissionValidator.ShouldNotHaveValidationErrorFor(x => x.WorkSites, model);
        }
Exemple #25
0
        /// <summary>
        /// Set Application Template Main
        /// </summary>
        /// <param name="application"></param>
        /// <param name="handlebarsTemplate"></param>
        /// <returns></returns>
        public static string PopulateHtmlTemplateWithApplicationData(ApplicationSubmission application, string handlebarsTemplate)
        {
            Handlebars.RegisterHelper("boolOrString", (writer, context, parameters) =>
            {
                string value = parameters[0].ToString();
                switch (value.ToLower())
                {
                case "true":
                    value = "Yes";
                    break;

                case "false":
                    value = "No";
                    break;

                case "":
                    value = "NOT PROVIDED";
                    break;
                }
                writer.WriteSafeString(value);
            });

            Handlebars.RegisterHelper("formatAddress", (writer, context, parameters) =>
            {
                if (parameters[0].GetType() == typeof(Address))
                {
                    Address value = (Address)parameters[0];
                    writer.WriteSafeString($"{value.StreetAddress}<div>{value.City}, {value.State} {value.ZipCode}</div><div>{value.County}</div>");
                }
            });

            Handlebars.RegisterHelper("formatAttachment", (writer, context, parameters) =>
            {
                if (parameters[0].GetType() == typeof(Attachment))
                {
                    Attachment value = (Attachment)parameters[0];
                    writer.WriteSafeString($"<div>{value.OriginalFileName}</div>");
                }
            });

            var template = Handlebars.Compile(handlebarsTemplate);

            return(template(application));
        }
        public ApplicationSummary Build(ApplicationSubmission submission)
        {
            var obj = new ApplicationSummary
            {
                Id = submission.Id.ToString(),
                ApplicationType           = BuildResponseSummary(submission.ApplicationType),
                CertificateEffectiveDate  = submission.CertificateEffectiveDate,
                CertificateExpirationDate = submission.CertificateExpirationDate,
                CertificateNumber         = submission.CertificateNumber,
                CertificateType           = submission.EstablishmentType.Select(x => BuildResponseSummary(x.EstablishmentType)),
                NumWorkers   = submission.WorkSites.Sum(x => x.Employees.Count),
                NumWorkSites = submission.WorkSites.Count,
                State        = submission.Employer.PhysicalAddress.State,
                Status       = BuildStatusSummary(submission.Status),
                EmployerName = submission.Employer.LegalName
            };

            return(obj);
        }
        public void ApplicationSubmissionEstablishmentType_PublicProperties()
        {
            var applicationSubmission = new ApplicationSubmission()
            {
            };
            var response = new Response()
            {
            };
            var obj = new ApplicationSubmissionEstablishmentType
            {
                ApplicationSubmission   = applicationSubmission,
                ApplicationSubmissionId = Guid.Empty,
                EstablishmentType       = response,
                EstablishmentTypeId     = 1
            };

            Assert.AreEqual(applicationSubmission, obj.ApplicationSubmission);
            Assert.AreEqual(Guid.Empty, obj.ApplicationSubmissionId);
            Assert.AreEqual(response, obj.EstablishmentType);
            Assert.AreEqual(1, obj.EstablishmentTypeId);
        }
Exemple #28
0
        public void ApplicationService_Cleanup_SCAWageDetermination()
        {
            // Arrange
            var obj = new ApplicationSubmission
            {
                PieceRateWageInfo = new PieceRateWageInfo
                {
                    PrevailingWageMethodId         = ResponseIds.PrevailingWageMethod.SCAWageDetermination,
                    MostRecentPrevailingWageSurvey = new PrevailingWageSurveyInfo(),
                    AlternateWageData = new AlternateWageData(),
                    SCAWageDeterminationAttachmentId = Guid.NewGuid().ToString()
                }
            };

            // Act
            _applicationService.ProcessModel(obj);

            // Assert
            Assert.IsNull(obj.PieceRateWageInfo.MostRecentPrevailingWageSurvey);
            Assert.IsNull(obj.PieceRateWageInfo.AlternateWageData);
            Assert.IsNotNull(obj.PieceRateWageInfo.SCAWageDeterminationAttachmentId);
        }
Exemple #29
0
        public void ApplicationDataTest()
        {
            // Setup
            ApplicationSubmission testApplication = new ApplicationSubmission();
            List <Attachment>     attachments     = new List <Attachment>();
            List <PDFContentData> pdfContentList  = new List <PDFContentData>();

            _mockApplicationService.Setup(mock => mock.GetApplicationById(It.IsAny <Guid>())).Returns(testApplication);

            _mockAttachmentService.Setup(mock => mock.GetApplicationFormViewContent(testApplication, It.IsAny <string>())).Returns("This is some HTML that is filled in");
            _mockAttachmentService.Setup(mock => mock.GetApplicationAttachments(testApplication)).Returns(attachments);
            _mockAttachmentService.Setup(mock => mock.PrepareApplicationContentsForPdfConcatenation(attachments, It.IsAny <string>())).Returns(pdfContentList);

            // Execute
            string testFilePath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\TestFiles"));
            var    applicationViewTemplatePath = Path.Combine(testFilePath, "Section14cApplicationPdfView.html");
            ApplicationDocumentHelper applicationDocumentHelper = new ApplicationDocumentHelper(_mockApplicationService.Object, _mockAttachmentService.Object);
            var applicationAttachmentsData = applicationDocumentHelper.ApplicationData(new Guid("CE7F5AA5-6832-43FE-BAE1-80D14CD8F666"), applicationViewTemplatePath);

            // Assert
            _mockAttachmentService.Verify(mock => mock.PrepareApplicationContentsForPdfConcatenation(attachments, "This is some HTML that is filled in"), Times.Once());
            Assert.AreEqual(pdfContentList, applicationAttachmentsData, "returns the expected data");
        }
Exemple #30
0
        public void ApplicationService_Does_Not_CleanUp_Renewal_Application()
        {
            // Arrange
            var obj = new ApplicationSubmission
            {
                ApplicationTypeId = ResponseIds.ApplicationType.Renewal,
                Employer          =
                    new EmployerInfo
                {
                    FiscalQuarterEndDate     = DateTime.Now,
                    NumSubminimalWageWorkers = new WorkerCountInfo()
                },
                PayTypeId         = ResponseIds.PayType.Both,
                HourlyWageInfo    = new HourlyWageInfo(),
                PieceRateWageInfo = new PieceRateWageInfo(),
                WorkSites         = new List <WorkSite>
                {
                    new WorkSite {
                        NumEmployees = 1, Employees = new List <Employee> {
                            new Employee()
                        }
                    }
                }
            };

            // Act
            _applicationService.ProcessModel(obj);

            // Assert
            Assert.IsNotNull(obj.Employer.FiscalQuarterEndDate);
            Assert.IsNotNull(obj.Employer.NumSubminimalWageWorkers);
            Assert.IsNotNull(obj.PayTypeId);
            Assert.IsNotNull(obj.HourlyWageInfo);
            Assert.IsNotNull(obj.PieceRateWageInfo);
            Assert.IsNotNull(obj.WorkSites.ElementAt(0).NumEmployees);
            Assert.IsNotNull(obj.WorkSites.ElementAt(0).Employees);
        }
        public ActionResult Details(ApplicationSubmission applicationSubmission, string acceptButton, string declineButton )
        {
            ApplicationSubmission submission = db.ApplicationSubmissions.Find(applicationSubmission.ApplicationID, applicationSubmission.ProductID);

               if (acceptButton != null)
               {
                    submission.Status = SubmissionStatus.Accepted;
                    submission.LastModifiedDate = DateTime.Now;

                    EmailHelper.SendLoanApprovedEmail(submission);
               }

               if (declineButton != null)
               {
                    submission.Status = SubmissionStatus.Declined;
                    submission.LastModifiedDate = DateTime.Now;

                    EmailHelper.SendLoanDeclinedEmail(submission);
               }

               db.SaveChanges();

               return RedirectToAction("Index");
        }