Beispiel #1
0
        private ActionResult RedirectToResults()
        {
            var answers     = _answerManager.GetAnswers();
            var outcomeType = _personaManager.GetOutcomeType(answers.ToDictionary(x => x.Key.Id, x => x.Value));

            switch (outcomeType)
            {
            case OutcomeType.Business:
                return(RedirectToAction(MVC.Results.Business().AddRouteValues(_answerManager.GetNameValueCollection())));

            case OutcomeType.Hobby:
                return(RedirectToAction(MVC.Results.Hobby().AddRouteValues(_answerManager.GetNameValueCollection())));

            default:
                return(RedirectToAction(MVC.Results.Unsure().AddRouteValues(_answerManager.GetNameValueCollection())));
            }
        }
Beispiel #2
0
        public void MatchesPersona1()
        {
            // Arrange
            IDictionary <string, IAnswer[]> answers = new Dictionary <string, IAnswer[]>();

            answers.Add("Q1", new IAnswer[] { new Answer {
                                                  Id = "A"
                                              } });
            answers.Add("Q2", new IAnswer[] { new Answer {
                                                  Id = "A"
                                              } });
            answers.Add("Q3", new IAnswer[] { new Answer {
                                                  Id = "A"
                                              } });

            // Act
            var persona     = _manager.GetPersona(answers);
            var outcomeType = _manager.GetOutcomeType(answers);

            //Assert
            Assert.IsNotNull(persona);
            Assert.AreEqual("1", persona.Id);
            Assert.AreEqual(OutcomeType.Hobby, outcomeType);
        }