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_SelectIndex_NewIndexIsSelected(int row, int column)
        {
            var model = new TableSingleSelectionModel();
            var args = new List<SelectionChangedEventArgs>();
            var expectedEvent = new SelectionChangedEventArgs(row, column, true);
            model.SelectionChanged += (obj, arg) => args.Add(arg);

            model.SelectIndex(row, column);

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

            model.SelectIndex(row, column);

            Assert.IsFalse(wasSelected);
        }
 public void SelectIndex_InvalidIndexes_ThrowsException(int row, int column)
 {
     var model = new TableSingleSelectionModel();
     Assert.Throws(typeof(ArgumentOutOfRangeException), delegate { model.SelectIndex(row, column); });
 }