public void AnalyzeReturnSlugNameAsTheTitle() { using (var controller = new SurveysController(null, null, new Mock <ISurveyAnswersSummaryStore>().Object, 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 AnalyzeGetsTheSummaryFromTheStore() { var mockSurveyAnswersSummaryStore = new Mock <ISurveyAnswersSummaryStore>(); using (var controller = new SurveysController(null, null, mockSurveyAnswersSummaryStore.Object, null, null)) { controller.Analyze("tenant", "slug-name"); } mockSurveyAnswersSummaryStore.Verify(r => r.GetSurveyAnswersSummary("tenant", "slug-name"), Times.Once()); }
public async Task AnalyzeReturnSlugNameAsTheTitle() { var mockTenantStore = new Mock <ITenantStore>(); mockTenantStore.Setup(r => r.GetTenantAsync(It.IsAny <string>())) .ReturnsAsync(new Tenant()); using (var controller = new SurveysController(null, null, new Mock <ISurveyAnswersSummaryStore>().Object, mockTenantStore.Object, null)) { var result = await controller.Analyze(string.Empty, "slug-name") as ViewResult; var model = result.ViewData.Model as TenantMasterPageViewData; Assert.AreSame("slug-name", model.Title); } }
public async Task AnalyzeGetsTheSummaryFromTheStore() { var mockSurveyAnswersSummaryStore = new Mock <ISurveyAnswersSummaryStore>(); var mockTenantStore = new Mock <ITenantStore>(); mockTenantStore.Setup(r => r.GetTenantAsync(It.IsAny <string>())) .ReturnsAsync(new Tenant()); using (var controller = new SurveysController(null, null, mockSurveyAnswersSummaryStore.Object, mockTenantStore.Object, null)) { await controller.Analyze("tenant", "slug-name"); } mockSurveyAnswersSummaryStore.Verify(r => r.GetSurveyAnswersSummaryAsync("tenant", "slug-name"), Times.Once()); }
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)) { var result = controller.Analyze(string.Empty, string.Empty) as ViewResult; var model = result.ViewData.Model as TenantPageViewData <SurveyAnswersSummary>; Assert.AreSame(surveyAnswersSummary, model.ContentModel); } }