public void IndexReturnsTheSurveysForTheTenantInTheModel()
        {
            var mockSurveyStore = new Mock<ISurveyStore>();
            mockSurveyStore.Setup(r => r.GetSurveysByTenant(It.IsAny<string>()))
                .Returns(new List<Survey>() { new Survey() { Title = "title" } });

            using (var controller = new SurveysController(mockSurveyStore.Object, null, null, null, null, null))
            {
                controller.Tenant = new Tenant() { SubscriptionKind = SubscriptionKind.Standard };

                var result = controller.Index() as ViewResult;

                var model = result.ViewData.Model as TenantPageViewData<IEnumerable<Survey>>;

                Assert.AreEqual(1, model.ContentModel.Count());
                Assert.AreEqual("title", model.ContentModel.First().Title);
            }
        }
        public void IndexReturnsEmptyViewName()
        {
            using (var controller = new SurveysController(new Mock<ISurveyStore>().Object, null, null, null, null, null))
            {
                var result = controller.Index() as ViewResult;

                Assert.AreEqual(string.Empty, result.ViewName);
            }
        }
        public void IndexReturnsMySurveysAsTitleInTheModel()
        {
            using (var controller = new SurveysController(new Mock<ISurveyStore>().Object, null, null, null, null, null))
            {
                var result = controller.Index() as ViewResult;

                var model = result.ViewData.Model as TenantMasterPageViewData;
                Assert.AreSame("My Surveys", model.Title);
            }
        }
        public void IndexCallsGetAllSurveysByTenantFromSurveyStore()
        {
            var mockSurveyStore = new Mock<ISurveyStore>();

            using (var controller = new SurveysController(mockSurveyStore.Object, null, null, null, null, null))
            {
                controller.TenantName = "tenant";

                controller.Index();
            }

            mockSurveyStore.Verify(r => r.GetSurveysByTenant(It.Is<string>(actual => "tenant" == actual)), Times.Once());
        }