Exemple #1
0
        public void FillSource()
        {
            var TempTableColumns = new TableColumns();
            var TempSource       = new Source("My Source");
            var TempTable        = TempSource.AddTable("Table A", "dbo");
            var ConstraintsToAdd = new List <dynamic>
            {
                new Dynamo(new
                {
                    Table                       = "Table A",
                    Definition                  = "My Definition",
                    Column                      = "Column A",
                    COLUMN_TYPE                 = "Int",
                    MAX_LENGTH                  = 4,
                    IS_NULLABLE                 = false,
                    IS_IDENTITY                 = false,
                    IS_INDEX                    = 1,
                    PRIMARY_KEY                 = "PK_Table_A",
                    UNIQUE                      = "IX_Table_A",
                    FOREIGN_KEY_TABLE           = "",
                    FOREIGN_KEY_COLUMN          = "",
                    DEFAULT_VALUE               = "",
                    ComputedColumnSpecification = ""
                })
            };

            TempTableColumns.FillSource(ConstraintsToAdd, TempSource);
            var TempTable2 = (Modeler.Providers.Table)TempSource.Tables[0];
            var Column     = TempTable2.Columns[0];

            Assert.Equal("Column A", Column.Name);
            Assert.Equal(DbType.Int32, Column.DataType);
            Assert.False(Column.AutoIncrement);
            Assert.Equal("", Column.ComputedColumnSpecification);
            Assert.Equal("", Column.Default);
            Assert.Empty(Column.ForeignKey);
            Assert.True(Column.Index);
            Assert.Equal(4, Column.Length);
            Assert.False(Column.Nullable);
            Assert.False(Column.OnDeleteCascade);
            Assert.False(Column.OnDeleteSetNull);
            Assert.False(Column.OnUpdateCascade);
            Assert.Equal(TempTable, Column.ParentTable);
            Assert.True(Column.PrimaryKey);
            Assert.True(Column.Unique);
        }