Пример #1
0
 public void DefaultConstructor_CreatesColumnInstance()
 {
     // Call
     using (var column = new DataGridViewColorColumn())
     {
         // Assert
         Assert.IsInstanceOf <DataGridViewColumn>(column);
     }
 }
Пример #2
0
        public void CellTemplate_WithColorCell_CellTemplateSet()
        {
            // Setup
            using (var column = new DataGridViewColorColumn())
            {
                var dataGridViewCell = new DataGridViewColorCell();

                // Call
                column.CellTemplate = dataGridViewCell;

                // Assert
                Assert.AreSame(dataGridViewCell, column.CellTemplate);
            }
        }
Пример #3
0
        public void CellTemplate_WithOtherCell_ThrowsArgumentException()
        {
            // Setup
            using (var column = new DataGridViewColorColumn())
                using (var dataGridViewCell = new DataGridViewTextBoxCell())
                {
                    // Call
                    TestDelegate test = () => column.CellTemplate = dataGridViewCell;

                    // Assert
                    var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(
                        test,
                        $"Given template must be of type {typeof(DataGridViewColorCell)}");
                    Assert.AreEqual("value", exception.ParamName);
                }
        }