Пример #1
0
        public void ShouldAddColumnToCollection()
        {
            var columns = new ColumnEntityCollection();

            columns.Add(DatabaseEntityFactory.CreateColumnEntity("CustomerId", new ColumnDataTypeDefinition("int", false), true, 1, false, null, null));

            Assert.That(columns.Count(), Is.EqualTo(1));
        }
Пример #2
0
        public void ShouldGetColumnFromCollection()
        {
            var columns = new ColumnEntityCollection();
            var column  = DatabaseEntityFactory.CreateColumnEntity("CustomerId", new ColumnDataTypeDefinition("int", false), true, 1, false, null, null);

            columns.Add(column);

            Assert.That(columns[0], Is.EqualTo(column));
            Assert.That(columns.Get("CustomerId"), Is.EqualTo(column));
        }
Пример #3
0
        public void ShouldGetExceptionWhenTryingToGetColumnThatDoesNotExist()
        {
            bool exceptionHappened = false;
            var  columns           = new ColumnEntityCollection();

            try
            {
                Assert.That(columns[0], Is.Null);
                Assert.That(columns.Get("CustomerId"), Is.Null);
            }
            catch (KeyNotFoundException)
            {
                exceptionHappened = true;
            }
            Assert.That(exceptionHappened);
        }
 public TableEntity(string tableSchema, string tableName)
 {
     TableName   = tableName;
     TableSchema = tableSchema;
     _columns    = new ColumnEntityCollection();
 }