Exemplo n.º 1
0
        //As a content author, I want to enter and edit the hours overview in the job profile template
        public void DFC2103ForJobProfileWorkingHours(string minHours, string maxHours)
        {
            // Arrange
            var indexView = new _MVC_Views_JobProfileDetails_Index_cshtml();

            var maxAndMinHoursAreBlankTestText = "Vairable";

            var model = new JobProfileDetailsViewModel
            {
                MinimumHours = minHours,
                MaximumHours = maxHours,
                MaxAndMinHoursAreBlankText = maxAndMinHoursAreBlankTestText
            };

            // Act
            var htmlDom = indexView.RenderAsHtml(model);

            // Asserts
            if (string.IsNullOrWhiteSpace(model.MinimumHours) || string.IsNullOrWhiteSpace(model.MaximumHours))
            {
                GetHoursSummaryText(htmlDom).Should().Be(maxAndMinHoursAreBlankTestText);
            }
            else
            {
                GetHoursSummaryText(htmlDom).Should().Be($"{model.MinimumHours} to {model.MaximumHours}");
            }
        }
Exemplo n.º 2
0
        public void DFC3080JobProfileSalaryContextLink()
        {
            var indexView = new _MVC_Views_JobProfileDetails_Index_cshtml();

            var model = new JobProfileDetailsViewModel
            {
                SalaryContextText = "context text",
                SalaryContextLink = "contextlink",
                SalaryStarter     = 1000,
                SalaryExperienced = 2000,
                SalaryTextSpan    = "Salary Text"
            };

            // Act
            var htmlDom = indexView.RenderAsHtml(model);

            // Asert
            var salaryDiv = htmlDom.GetElementbyId("Salary");

            IEnumerable <HtmlNode> links = null;

            if (salaryDiv != null)
            {
                links = salaryDiv.Descendants("a");
            }

            links.Should().NotBeNull();
            links.Count().Should().Be(1);
            links.First().InnerText.Should().Be(model.SalaryContextText);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the job profile details view.
        /// </summary>
        /// <param name="model">Job profile view model</param>
        /// <returns>Index View</returns>
        private async Task <ActionResult> GetJobProfileDetailsViewAsync(JobProfileDetailsViewModel model = null)
        {
            if (model == null)
            {
                model = mapper.Map <JobProfileDetailsViewModel>(CurrentJobProfile);
            }

            //Map all the related Jobprofie fieldsin the model
            model.SalaryText                 = SalaryText;
            model.SalaryTextSpan             = SalaryTextSpan;
            model.SalaryBlankText            = SalaryBlankText;
            model.SalaryStarterText          = SalaryStarterText;
            model.SalaryExperiencedText      = SalaryExperiencedText;
            model.SalaryContextLink          = SalaryContextLink;
            model.SalaryContextText          = SalaryContextText;
            model.HoursText                  = HoursText;
            model.MaxAndMinHoursAreBlankText = MaxAndMinHoursAreBlankText;
            model.HoursTimePeriodText        = HoursTimePeriodText;
            model.WorkingPatternText         = WorkingPatternText;
            model.WorkingPatternSpanText     = WorkingPatternSpanText;

            if (model.IsLMISalaryFeedOverriden != true)
            {
                model = await PopulateSalaryAsync(model);
            }

            return(View("Index", model));
        }
Exemplo n.º 4
0
        public void DFC2047ForJobProfileSalary(string salaryStarterValue, string salaryExperiencedValue)
        {
            // Arrange
            var indexView = new _MVC_Views_JobProfileDetails_Index_cshtml();

            string salaryBlankText       = "Vairable";
            string salaryStarterText     = "Starter";
            string salaryExperiencedText = "Experienced";

            double salaryStarter = 0;

            if (double.TryParse(salaryStarterValue, out var salaryStarterGoodValue))
            {
                salaryStarter = salaryStarterGoodValue;
            }

            double salaryExperienced = 0;

            if (double.TryParse(salaryExperiencedValue, out var salaryExperiencedGoodValue))
            {
                salaryExperienced = salaryExperiencedGoodValue;
            }

            var model = new JobProfileDetailsViewModel
            {
                SalaryStarter         = salaryStarter,
                SalaryExperienced     = salaryExperienced,
                SalaryBlankText       = salaryBlankText,
                SalaryStarterText     = salaryStarterText,
                SalaryExperiencedText = salaryExperiencedText,
            };

            // Act
            var htmlDom = indexView.RenderAsHtml(model);

            // Asserts
            if (model.SalaryStarter > 0 && model.SalaryExperienced > 0)
            {
                GetSalaryStarter(htmlDom, salaryStarterText).Should().Be(model.SalaryStarter);
                GetSalaryExperienced(htmlDom, salaryExperiencedText).Should().Be(model.SalaryExperienced);
            }
            else
            {
                GetSalaryBlankText(htmlDom).Should().Be(salaryBlankText);
            }
        }
Exemplo n.º 5
0
        private async Task <JobProfileDetailsViewModel> PopulateSalaryAsync(JobProfileDetailsViewModel model)
        {
            var properties = new SearchProperties
            {
                FilterBy = $"{nameof(JobProfileIndex.UrlName)} eq '{model.UrlName.Replace("'", "''")}'"
            };

            var jobProfileSearchResult = await searchQueryService.SearchAsync(model.Title, properties);

            var jobProfileIndexItem = jobProfileSearchResult.Results.FirstOrDefault()?.ResultItem;

            if (jobProfileIndexItem != null)
            {
                model.SalaryStarter     = jobProfileIndexItem.SalaryStarter;
                model.SalaryExperienced = jobProfileIndexItem.SalaryExperienced;
            }

            return(model);
        }
Exemplo n.º 6
0
        public void DFC2086ForJobProfileWorkingPattern(string workingPattern, string workingPatternDetails)
        {
            // Arrange
            var indexView = new _MVC_Views_JobProfileDetails_Index_cshtml();

            var model = new JobProfileDetailsViewModel
            {
                WorkingPattern        = workingPattern,
                WorkingPatternDetails = workingPatternDetails,
            };

            // Act
            var htmlDom = indexView.RenderAsHtml(model);

            // Asserts
            if (string.IsNullOrEmpty(model.WorkingPattern))
            {
                // Nothing to display
                GetWorkingPatternText(htmlDom).Should().Be(null);
                GetWorkingPatternDetailText(htmlDom).Should().Be(null);
            }
            else
            {
                if (!string.IsNullOrEmpty(model.WorkingPatternDetails))
                {
                    // Display WorkingPatternDetails
                    GetWorkingPatternDetailText(htmlDom).Should().Be(workingPatternDetails);
                }
                else
                {
                    // No WorkingPatternDetails to be displyed
                    GetWorkingPatternDetailText(htmlDom).Should().Be(null);
                }

                // Display WorkingPattern
                GetWorkingPatternText(htmlDom).Should().Contain(workingPattern);
            }
        }