Implements a column of cells that support a DateTimePicker
Inheritance: System.Windows.Forms.DataGridViewColumn
 public void Test_CellTemplateIsCalendarCell()
 {
     //---------------Set up test pack-------------------
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     DataGridViewDateTimeColumn dtColumn = new DataGridViewDateTimeColumn();
     //---------------Test Result -----------------------
     Assert.IsInstanceOf(typeof(CalendarCell), dtColumn.CellTemplate);
 }
        public void Test_SetCellTemplate()
        {
            //---------------Set up test pack-------------------
            DataGridViewDateTimeColumn dtColumn = new DataGridViewDateTimeColumn();
            CalendarCell calendarCell = new CalendarCell();
            //---------------Assert Precondition----------------
            Assert.AreNotSame(calendarCell, dtColumn.CellTemplate);
            //---------------Execute Test ----------------------
            dtColumn.CellTemplate = calendarCell;

            //---------------Test Result -----------------------
            Assert.AreSame(calendarCell, dtColumn.CellTemplate);
        }
        public void Test_SetCellTemplate_MustBeCalendarCell()
        {
            //---------------Set up test pack-------------------
            DataGridViewDateTimeColumn dtColumn = new DataGridViewDateTimeColumn();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            bool errorThrown = false;
            try
            {
                dtColumn.CellTemplate = new System.Windows.Forms.DataGridViewCheckBoxCell();
            }
            catch (InvalidCastException) { errorThrown = true; }
            //---------------Test Result -----------------------
            Assert.IsTrue(errorThrown, "Cell Template must be type of CalendarCell");
        }
Exemplo n.º 4
0
 ///<summary>
 /// Constructor for <see cref="DataGridViewDateTimeColumnWin"/>
 ///</summary>
 ///<param name="dataGridViewColumn"></param>
 public DataGridViewDateTimeColumnWin(DataGridViewDateTimeColumn dataGridViewColumn)
     : base(dataGridViewColumn)
 {
 }
 ///<summary>
 /// Constructor for <see cref="DataGridViewDateTimeColumnWin"/>
 ///</summary>
 ///<param name="dataGridViewColumn"></param>
 public DataGridViewDateTimeColumnWin(DataGridViewDateTimeColumn dataGridViewColumn)
     : base(dataGridViewColumn)
 {
 }