コード例 #1
0
        public void Constructor_loads_persisted_setting(DiffListSortType persistedSetting)
        {
            AppSettings.DiffListSorting = persistedSetting;
            DiffListSortService service = new();

            Assert.AreEqual(persistedSetting, service.DiffListSorting);
        }
コード例 #2
0
        public void Changing_the_sort_modifies_persistence(DiffListSortType sortType)
        {
            DiffListSortService service = new();

            service.DiffListSorting = sortType;

            Assert.AreEqual(sortType, AppSettings.DiffListSorting);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public DiffListSortService()
 {
     DiffListSorting = GetSettingValueOrDefault();
 }
コード例 #6
0
 public void Setup()
 {
     _storedSetting = AppSettings.DiffListSorting;
 }
コード例 #7
0
 private static void AssertMenuItemTextAndLinkedSortType(ToolStripItem menuItem, string expectedText, DiffListSortType expectedSortType)
 {
     Assert.AreEqual(expectedText, menuItem.Text);
     Assert.AreEqual(expectedSortType, menuItem.Tag);
 }