Пример #1
0
        public void AdminController_Preview_Action_Should_Fetch_A_Survey_From_Repo()
        {
            // arrange
            var repositoryStub = MockRepository.GenerateStub<IRepository>();
            var sut = new AdminController(repositoryStub);
            const int surveyId = 1;
            var survey = new Survey();
            repositoryStub
                .Stub(x => x.GetSurvey(surveyId))
                .Return(survey);

            // act
            var sur = repositoryStub.GetSurvey(surveyId);
            var actual = sut.Preview(surveyId);

            // assert
            var viewResult = (PartialViewResult)actual;
            Assert.AreEqual(survey, viewResult.ViewData.Model);
            Assert.AreEqual("selected", sut.TempData["Selected_Admin"], "Selected tab was incorrect.");
        }