public void ApplyRules_WhenCookieHelperIsNull_ThrowsArgumentNullException() { IDashboardRules dashboardRules = CreateDashboardRules(); OSDevGrp.MyDashboard.Web.Models.DashboardSettingsViewModel sut = CreateSut(); sut.ApplyRules(dashboardRules, null); }
public void ApplyRules_WhenDashboardRulesIsNull_ThrowsArgumentNullException() { const IDashboardRules dashboardRules = null; OSDevGrp.MyDashboard.Web.Models.DashboardSettingsViewModel sut = CreateSut(); sut.ApplyRules(dashboardRules, _cookieHelperMock.Object); }
public void ApplyRules_WhenCalled_AssertAllowNsfwContentWasCalledOnDashboardRules() { Mock <IDashboardRules> dashboardRulesMock = CreateDashboardRulesMock(); OSDevGrp.MyDashboard.Web.Models.DashboardSettingsViewModel sut = CreateSut(); sut.ApplyRules(dashboardRulesMock.Object, _cookieHelperMock.Object); dashboardRulesMock.Verify(m => m.AllowNsfwContent, Times.Once); }
public void ApplyRules_WhenCalledWhereAllowNsfwContentIsFalseInDasboardRules_AssertToCookieWasCalledOnCookieHelperWithDashboardSettingsViewModel() { const bool allowNsfwContent = false; IDashboardRules dashboardRules = CreateDashboardRules(allowNsfwContent: allowNsfwContent); OSDevGrp.MyDashboard.Web.Models.DashboardSettingsViewModel sut = CreateSut(); sut.ApplyRules(dashboardRules, _cookieHelperMock.Object); _cookieHelperMock.Verify(m => m.ToCookie(It.Is <OSDevGrp.MyDashboard.Web.Models.DashboardSettingsViewModel>(value => value == sut)), Times.Once); }
public void ApplyRules_WhenCalledWhereAllowNsfwContentIsTrueInDasboardRules_ExpectRulesHasBeenApplid() { const bool allowNsfwContent = true; IDashboardRules dashboardRules = CreateDashboardRules(allowNsfwContent: allowNsfwContent); bool includeNsfwContent = _random.Next(100) > 50; bool onlyNsfwContent = _random.Next(100) > 50; OSDevGrp.MyDashboard.Web.Models.DashboardSettingsViewModel sut = CreateSut(includeNsfwContent: includeNsfwContent, onlyNsfwContent: onlyNsfwContent); sut.ApplyRules(dashboardRules, _cookieHelperMock.Object); Assert.IsTrue(sut.AllowNsfwContent); Assert.IsTrue(sut.IncludeNsfwContent.HasValue); Assert.AreEqual(includeNsfwContent, sut.IncludeNsfwContent); Assert.IsTrue(sut.OnlyNsfwContent.HasValue); Assert.AreEqual(onlyNsfwContent, sut.OnlyNsfwContent); }