public void Init() { _testTable = new SysTable() { Name = "TestTable" }; _testColumn = new SysColumn() { ColumnID = 1, Name = "TestColumn", Identity = false, Nullable = false, SystemType = SysType.NVarChar, MaxLength = 512 }; }
public override String GenerateSql(SysTable table, SysColumn schemaObject) { return CreateSql(table.Name, schemaObject, "ADD"); }
public void SysColumn_CreateSchemaString() { var intColumn = new SysColumn() { Name = "SomeNumber", Identity = false, Nullable = true, SystemType = SysType.Int }; Assert.AreEqual(intColumn.CreateSchemaString(), "[SomeNumber] int NULL"); var decimalColumn = new SysColumn() { Name = "SomeDecimal", Identity = false, Nullable = true, Precision = 19, Scale = 5, SystemType = SysType.Decimal }; Assert.AreEqual(decimalColumn.CreateSchemaString(), "[SomeDecimal] decimal(19,5) NULL"); var varcharColumn = new SysColumn() { Name = "Name", Identity = false, Nullable = false, MaxLength = -1, //UserLength = "max", SystemType = SysType.VarChar }; Assert.AreEqual(varcharColumn.CreateSchemaString(), "[Name] varchar(max) NOT NULL"); var nvarcharColumn = new SysColumn() { Name = "Name", Identity = false, Nullable = true, MaxLength = 510, //UserLength = "255", SystemType = SysType.NVarChar }; Assert.AreEqual(nvarcharColumn.CreateSchemaString(), "[Name] nvarchar(255) NULL"); var identityColumn = new SysColumn() { Name = "IdentityColumn", Identity = true, Nullable = false, SystemType = SysType.Int }; Assert.AreEqual(identityColumn.CreateSchemaString(), "[IdentityColumn] int IDENTITY NOT NULL"); var bigIntIdentityColumn = new SysColumn() { Name = "BigIntIdentityColumn", Identity = true, Nullable = false, SystemType = SysType.BigInt }; Assert.AreEqual(bigIntIdentityColumn.CreateSchemaString(), "[BigIntIdentityColumn] bigint IDENTITY NOT NULL"); }