示例#1
0
        public void SetUp()
        {
            ExpectedSurveyAdress       = new SurveyAdress(123, 7, "rue de Rivoli", "75000", "Paris");
            ExpectedSurveyLocationList = new List <ISurveyLocations>
            {
                new SurveyLocations(100, ExpectedSurveyAdress, CompletionStatus.TODO)
            };
            ExpectedSurveyQuestionList = new List <ISurveyQuestion>
            {
                new SurveyQuestion {
                    Id = 1, Question = "Q1"
                },
                new SurveyQuestion {
                    Id = 2, Question = "Q2"
                },
            };
            ExpectedSurvey = new Survey(175, "AnswerToAskOptionalQuestion", "AnswerToAskQuestion",
                                        ExpectedSurveyAdress, ExpectedSurveyQuestionList);

            questionHelper = Substitute.For <IQuestionHelper>();
            questionHelper.AskQuestion(Arg.Any <string>()).Returns("AnswerToAskQuestion");
            questionHelper.AskOptionalQuestion(Arg.Any <string>()).Returns("AnswerToAskOptionalQuestion");
            questionHelper.AskYesNoQuestion(Arg.Any <string>()).Returns(true);

            surveyLocationGetter = Substitute.For <ISurveyLocationGetter>();
            surveyLocationGetter.GetSurveyLocation().Returns(ExpectedSurveyLocationList);

            surveyQuestionGetter = Substitute.For <ISurveyQuestionGetter>();
            surveyQuestionGetter.GetSurveyQuestion().Returns(ExpectedSurvey);

            surveyCampaignMaker = new SurveyCampaignMaker(questionHelper, surveyLocationGetter, surveyQuestionGetter);
        }
        public Campaign CreateNewCampaign()
        {
            Console.WriteLine("Welcome in the survey campaign maker.");

            var answer = _questionHelper.AskYesNoQuestion("Would you like to create a new survey campaign ?");

            if (answer)
            {
                Console.WriteLine("Ok, let's make a survey.");

                var survey       = _surveyQuestionGetter.GetSurveyQuestion();
                var locationList = _surveyLocationGetter.GetSurveyLocation();

                return(new Campaign(survey, locationList)
                {
                    Id = 175,
                    SurveyId = survey.Id
                });
            }
            else
            {
                return(GetPreMadeCampaign());
            }
        }
        public void Should_Have_Expected_SurveyLocation_When_GetSurveyLocation_Method_Is_Called()
        {
            var actual = surveyLocationGetter.GetSurveyLocation();

            Check.That(actual.First()).HasFieldsWithSameValues(expectedSurveyLocation);
        }