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

            sut.TopContent();

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

            IActionResult result = sut.TopContent();

            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 TopContent_WhenDashboardViewModelWasStoredInCoookie_ReturnsPartialViewResultForTopContent()
        {
            DashboardViewModel dashboardViewModel = BuildDashboardViewModel(_random);

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

            IActionResult result = sut.TopContent();

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

            PartialViewResult viewResult = (PartialViewResult)result;

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