public void AnalyzeReturnSlugNameAsTheTitle() { using (var controller = new SurveysController(null, null, new Mock<ISurveyAnswersSummaryStore>().Object, null, null, null)) { var result = controller.Analyze(string.Empty, "slug-name") as ViewResult; var model = result.ViewData.Model as TenantMasterPageViewData; Assert.AreSame("slug-name", model.Title); } }
public void AnalyzeReturnsTheSummaryGetFromTheStoreInTheModel() { var mockSurveyAnswersSummaryStore = new Mock<ISurveyAnswersSummaryStore>(); var surveyAnswersSummary = new SurveyAnswersSummary(); mockSurveyAnswersSummaryStore.Setup(r => r.GetSurveyAnswersSummary(It.IsAny<string>(), It.IsAny<string>())) .Returns(surveyAnswersSummary); using (var controller = new SurveysController(null, null, mockSurveyAnswersSummaryStore.Object, null, null, null)) { var result = controller.Analyze(string.Empty, string.Empty) as ViewResult; var model = result.ViewData.Model as TenantPageViewData<SurveyAnswersSummary>; Assert.AreSame(surveyAnswersSummary, model.ContentModel); } }
public void AnalyzeGetsTheSummaryFromTheStore() { var mockSurveyAnswersSummaryStore = new Mock<ISurveyAnswersSummaryStore>(); using (var controller = new SurveysController(null, null, mockSurveyAnswersSummaryStore.Object, null, null, null)) { controller.Analyze("tenant", "slug-name"); } mockSurveyAnswersSummaryStore.Verify(r => r.GetSurveyAnswersSummary("tenant", "slug-name"), Times.Once()); }