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

            sut.Settings();

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

            IActionResult result = sut.Settings();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(BadRequestResult));
        }
예제 #3
0
        public void Settings_WhenToDashboardSettingsViewModelWasStoredInCoookie_ReturnsPartialViewResultForDashboardSettings()
        {
            DashboardSettingsViewModel dashboardSettingsViewModel = BuildDashboardSettingsViewModel(_random);

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

            IActionResult result = sut.Settings();

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

            PartialViewResult viewResult = (PartialViewResult)result;

            Assert.IsNotNull(viewResult);
            Assert.IsNotNull(viewResult.ViewName);
            Assert.AreEqual("_DashboardSettingsPartial", viewResult.ViewName);
            Assert.IsNotNull(viewResult.Model);
            Assert.AreEqual(dashboardSettingsViewModel, viewResult.Model);
        }