private static void AssertIndexGetViews(ContactOption contactOption, ControllerResultTest <YourDetailsController> controllerResult, YourDetailsController controller)
 {
     if (contactOption == ContactOption.ContactAdviser)
     {
         controllerResult.ShouldRenderView("ContactAdvisor")
         .WithModel <ContactUsWithDobPostcodeViewModel>(vm =>
         {
             vm.PageTitle.Should().BeEquivalentTo(controller.PageTitle);
             vm.PageIntroduction.Should().BeEquivalentTo(controller.AdviserIntroduction);
             vm.PageIntroductionTwo.Should().BeEquivalentTo(controller.AdviserIntroductionTwo);
             vm.PostcodeHint.Should().BeEquivalentTo(controller.PostcodeHint);
             vm.DateOfBirthHint.Should().BeEquivalentTo(controller.DateOfBirthHint);
             vm.TermsAndConditionsText.Should().BeEquivalentTo(controller.TermsAndConditionsText);
         });
     }
     else
     {
         controllerResult.ShouldRenderView("Feedback")
         .WithModel <ContactUsWithConsentViewModel>(vm =>
         {
             vm.PageTitle.Should().BeEquivalentTo(controller.PageTitle);
             vm.DoYouWantUsToContactUsText.Should().BeEquivalentTo(controller.DoYouWantUsToContactUsText);
             vm.PageIntroduction.Should().BeEquivalentTo(controller.NonAdviserIntroduction);
             vm.TermsAndConditionsText.Should().BeEquivalentTo(controller.TermsAndConditionsText);
         });
     }
 }
Example #2
0
        public static ContentResult ShouldReturnXmlResult <T>(
            this ControllerResultTest <T> controllerResultTest) where T : Controller
        {
            controllerResultTest.ValidateActionReturnType <ContentResult>();

            var contentResult = (ContentResult)controllerResultTest.ActionResult;

            ValidateXmlContentType(contentResult);

            return((ContentResult)controllerResultTest.ActionResult);
        }
Example #3
0
        public static TwiMLResult ShouldReturnTwiMLResult <T>(
            this ControllerResultTest <T> controllerResultTest,
            Action <XDocument> assertion) where T : Controller
        {
            controllerResultTest.ValidateActionReturnType <ActionResult>();

            var twiMLResult = (TwiMLResult)controllerResultTest.ActionResult;
            var xdocument   = twiMLResult.Data as XDocument;

            assertion(xdocument);

            return((TwiMLResult)controllerResultTest.ActionResult);
        }
Example #4
0
        public static ContentResult ShouldReturnXmlResult <T>(
            this ControllerResultTest <T> controllerResultTest,
            Action <XDocument> assertion) where T : Controller
        {
            controllerResultTest.ValidateActionReturnType <ContentResult>();

            var contentResult = (ContentResult)controllerResultTest.ActionResult;

            ValidateXmlContentType(contentResult);

            var xdocument = XDocument.Parse(contentResult.Content);

            assertion(xdocument);

            return((ContentResult)controllerResultTest.ActionResult);
        }
 protected override void When()
 {
     Result = SUT.WithCallTo(c => c.Index());
 }
Example #6
0
 public static TwiMLResult ShouldReturnTwiMLResult <T>(
     this ControllerResultTest <T> controllerResultTest) where T : Controller
 {
     controllerResultTest.ValidateActionReturnType <TwiMLResult>();
     return((TwiMLResult)controllerResultTest.ActionResult);
 }
Example #7
0
 public void When_I_choose_to_edit_student_details()
 {
     _result = SUT.ExecuteActionFor <StudentController>(c => c.Edit(_student.Id));
 }
Example #8
0
 public void When_I_save_the_changes()
 {
     _result = SUT.ExecuteActionFor <StudentController>(c => c.Edit(_student));
 }