public void Constructor_loads_persisted_setting(DiffListSortType persistedSetting) { AppSettings.DiffListSorting = persistedSetting; DiffListSortService service = new(); Assert.AreEqual(persistedSetting, service.DiffListSorting); }
public void Changing_the_sort_modifies_persistence(DiffListSortType sortType) { DiffListSortService service = new(); service.DiffListSorting = sortType; Assert.AreEqual(sortType, AppSettings.DiffListSorting); }
private void AssertOnlyCheckedItemIs(DiffListSortType sortType) { var matchingSubItem = _itemUnderTest.DropDownItems.Cast <ToolStripMenuItem>().Single(i => i.Tag.Equals(sortType)); Assert.IsTrue(matchingSubItem.Checked); foreach (var otherItem in _itemUnderTest.DropDownItems.Cast <ToolStripMenuItem>().Except(new[] { matchingSubItem })) { Assert.IsFalse(otherItem.Checked); } }
public void Only_the_current_sort_option_is_selected(DiffListSortType sortType) { // assert the default setup is selected and then change it. AssertOnlyCheckedItemIs(DiffListSortType.FilePath); _testingSortService.DiffListSorting.Returns(sortType); // invoke the requery method to reselect the proper sub item _itemUnderTest.GetTestAccessor().SimulateOpeningEvent(); AssertOnlyCheckedItemIs(sortType); }
public DiffListSortService() { DiffListSorting = GetSettingValueOrDefault(); }
public void Setup() { _storedSetting = AppSettings.DiffListSorting; }
private static void AssertMenuItemTextAndLinkedSortType(ToolStripItem menuItem, string expectedText, DiffListSortType expectedSortType) { Assert.AreEqual(expectedText, menuItem.Text); Assert.AreEqual(expectedSortType, menuItem.Tag); }