/// <summary>
        /// Returns the section view.
        /// </summary>
        /// <returns>Action Result</returns>
        private ActionResult ReturnSectionView()
        {
            var model = new JobProfileWhatYouWillDoViewModel();

            if (CurrentJobProfile != null)
            {
                model = new JobProfileWhatYouWillDoViewModel
                {
                    TopSectionContent    = TopSectionContent,
                    BottomSectionContent = BottomSectionContent,
                    PropertyValue        = CurrentJobProfile.WhatYouWillDo,
                    Title                  = MainSectionTitle,
                    SectionId              = SectionId,
                    IsIntroActive          = IsWYDIntroActive,
                    DailyTasksSectionTitle = WhatYouWillDoSectionTitle,
                    EnvironmentTitle       = EnvironmentTitle,
                    IsWhatYouWillDoCadView = CurrentJobProfile.WhatYouWillDoData.IsCadReady
                };

                if (model.IsWhatYouWillDoCadView)
                {
                    model.Location     = formatContentService.GetParagraphText(LocationLeadingText, CurrentJobProfile.WhatYouWillDoData.Locations, LocationConjunction);
                    model.Uniform      = formatContentService.GetParagraphText(UniformLeadingText, CurrentJobProfile.WhatYouWillDoData.Uniforms, UniformConjunction);
                    model.Environment  = formatContentService.GetParagraphText(EnvironmentsLeadingText, CurrentJobProfile.WhatYouWillDoData.Environments, EnvironmentsConjunction);
                    model.Introduction = CurrentJobProfile.WhatYouWillDoData.Introduction;
                    model.DailyTasks   = CurrentJobProfile.WhatYouWillDoData.DailyTasks;
                }
            }

            return(View(model));
        }
Exemple #2
0
        public void WhatYouWillDoWorkingEnvironmentViewTests(string environmentTitle, string environment, string location, string uniform)
        {
            // Arrange
            var workingEnvironment     = new _MVC_Views_JobProfileWhatYouWillDo_WorkEnvironment_cshtml();
            var workingEnvironmentView = new JobProfileWhatYouWillDoViewModel
            {
                EnvironmentTitle = environmentTitle,
                Location         = location,
                Uniform          = uniform,
                Environment      = environment
            };

            // Act
            var htmlDocument = workingEnvironment.RenderAsHtml(workingEnvironmentView);

            // Assert
            if (string.IsNullOrWhiteSpace(environment) && string.IsNullOrWhiteSpace(uniform) && string.IsNullOrWhiteSpace(location))
            {
                AssertViewIsEmpty(htmlDocument);
                AssertContentDoesNotExistsInView(environmentTitle, htmlDocument);
            }

            if (!string.IsNullOrWhiteSpace(environment))
            {
                AssertContentExistsInView(environment, htmlDocument);
            }

            if (!string.IsNullOrWhiteSpace(uniform))
            {
                AssertContentExistsInView(uniform, htmlDocument);
            }

            if (!string.IsNullOrWhiteSpace(location))
            {
                AssertContentExistsInView(location, htmlDocument);
            }
        }
Exemple #3
0
        public void WhatYouWillDoIndexViewTests(bool cadReady, string jpWydData, string topContent, string bottomContent, string wydDailyTasks, bool wydIntroActive, string wydDescription, string sectionId)
        {
            // Arrange
            var whatYouWillDoView = new _MVC_Views_JobProfileWhatYouWillDo_Index_cshtml();
            var jobProfileWhatYouWillDoViewModel = new JobProfileWhatYouWillDoViewModel
            {
                PropertyValue          = jpWydData,
                TopSectionContent      = topContent,
                BottomSectionContent   = bottomContent,
                IsIntroActive          = wydIntroActive,
                DailyTasks             = wydDailyTasks,
                Introduction           = wydDescription,
                SectionId              = sectionId,
                IsWhatYouWillDoCadView = cadReady
            };

            // Act
            var htmlDocument = whatYouWillDoView.RenderAsHtml(jobProfileWhatYouWillDoViewModel);

            AssertSectionIdDisplayed(sectionId, htmlDocument);

            // Assert
            if (cadReady)
            {
                AssertContentDoesNotExistsInView(bottomContent, htmlDocument);
                AssertContentDoesNotExistsInView(topContent, htmlDocument);
                AssertContentDoesNotExistsInView(jpWydData, htmlDocument);
                if (!string.IsNullOrWhiteSpace(wydDailyTasks))
                {
                    AssertContentExistsInView(wydDailyTasks, htmlDocument);
                }

                if (!string.IsNullOrWhiteSpace(wydDescription) && wydIntroActive)
                {
                    AssertContentExistsInView(wydDescription, htmlDocument);
                }
                else
                {
                    AssertContentDoesNotExistsInView(wydDescription, htmlDocument);
                }
            }
            else
            {
                AssertContentDoesNotExistsInView(wydDailyTasks, htmlDocument);
                AssertContentDoesNotExistsInView(wydDescription, htmlDocument);
                if (!string.IsNullOrWhiteSpace(jpWydData))
                {
                    AssertContentExistsInView(jpWydData, htmlDocument);
                }

                if (!string.IsNullOrWhiteSpace(topContent))
                {
                    AssertContentExistsInView(topContent, htmlDocument);
                }

                if (!string.IsNullOrWhiteSpace(bottomContent))
                {
                    AssertContentExistsInView(bottomContent, htmlDocument);
                }
            }
        }