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)); }
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)); }
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(); }