Esempio n. 1
0
        public void DataGridViewCellErrorTextNeededEventArgs_ErrorText_Set_GetReturnsExpected(string value)
        {
            var dataGridView = new DataGridView
            {
                ColumnCount = 1,
                VirtualMode = true
            };
            DataGridViewCell cell = dataGridView.Rows[0].Cells[0];

            int callCount = 0;
            DataGridViewCellErrorTextNeededEventHandler handler = (sender, e) =>
            {
                callCount++;
                e.ErrorText = value;
                Assert.Equal(value, e.ErrorText);
            };

            dataGridView.CellErrorTextNeeded += handler;

            Assert.Same(value, cell.GetErrorText(0));
            Assert.Equal(1, callCount);
        }