public void SelectionChanged_SelectIndex_IsCalledTwice(int row, int column)
        {
            var model = new TableSingleSelectionModel();
            var args = new List<SelectionChangedEventArgs>();
            model.SelectionChanged += (obj, arg) => args.Add(arg);

            model.SelectIndex(row, column);

            Assert.AreEqual(2, args.Count);
        }
        public void SelectionChanged_UnselectIndex_ArgumentIsAsExpected(int row, int column)
        {
            var model = new TableSingleSelectionModel();
            var args = new List<SelectionChangedEventArgs>();
            var expectedArgument = new SelectionChangedEventArgs(row, column, false);
            model.SelectionChanged += (obj, arg) => args.Add(arg);

            model.UnselectIndex(row, column);

            AssertContainsEvent(expectedArgument, args);
        }
        public void SelectionChanged_UnselectOnNotSelectedIndex_NoEventRaised(int row, int column)
        {
            var model = new TableSingleSelectionModel();
            bool wasSelected = false;
            model.SelectionChanged += (obj, arg) => wasSelected = true;

            model.UnselectIndex(row, column);

            Assert.IsFalse(wasSelected);
        }
 public void IsSelected_DefaultSetup_IsTrue()
 {
     var model = new TableSingleSelectionModel();
     Assert.IsTrue(model.IsSelected(0, 0));
 }
 public void IsSelected_InvalidIndexes_ThrowsException(int row, int column)
 {
     var model = new TableSingleSelectionModel();
     Assert.Throws(typeof(ArgumentOutOfRangeException), delegate { model.IsSelected(row, column); });
 }