예제 #1
0
        public void SubContent_WhenCalled_AssertToDashboardViewModelWasCalledOnCookieHelper()
        {
            Web.Controllers.HomeController sut = CreateSut();

            sut.SubContent();

            _cookieHelperMock.Verify(m => m.ToDashboardViewModel());
        }
예제 #2
0
        public void SubContent_WhenDashboardViewModelWasNotStoredInCoookie_ReturnsPartialViewResultForEmptyContent()
        {
            Web.Controllers.HomeController sut = CreateSut(false);

            IActionResult result = sut.SubContent();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(PartialViewResult));

            PartialViewResult viewResult = (PartialViewResult)result;

            Assert.IsNotNull(viewResult);
            Assert.IsNotNull(viewResult.ViewName);
            Assert.AreEqual("_EmptyContentPartial", viewResult.ViewName);
            Assert.IsNull(viewResult.Model);
        }
예제 #3
0
        public void SubContent_WhenDashboardViewModelWasStoredInCoookie_ReturnsPartialViewResultForTopContent()
        {
            DashboardViewModel dashboardViewModel = BuildDashboardViewModel(_random);

            Web.Controllers.HomeController sut = CreateSut(dashboardViewModel: dashboardViewModel);

            IActionResult result = sut.SubContent();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(PartialViewResult));

            PartialViewResult viewResult = (PartialViewResult)result;

            Assert.IsNotNull(viewResult);
            Assert.IsNotNull(viewResult.ViewName);
            Assert.AreEqual("_SubContentPartial", viewResult.ViewName);
            Assert.IsNotNull(viewResult.Model);
            Assert.AreEqual(dashboardViewModel, viewResult.Model);
        }