public void Start() { Skip.IfNot(EnvUtils.IntegrationTestMachine); var tableName = _repository.TableName; var tableColumns = _repository.TableColumns; Assert.Equal("TestTable", tableName); Assert.NotNull(tableColumns); Assert.Equal(11, tableColumns.Count); var varChar100Column = tableColumns.FirstOrDefault(x => x.AttributeName == nameof(TestTableInfo.TypeVarChar100)); Assert.NotNull(varChar100Column); Assert.Equal(DataType.VarChar, varChar100Column.DataType); Assert.Equal(100, varChar100Column.DataLength); var varCharDefaultColumn = tableColumns.FirstOrDefault(x => x.AttributeName == nameof(TestTableInfo.TypeVarCharDefault)); Assert.NotNull(varCharDefaultColumn); Assert.Equal(DataType.VarChar, varCharDefaultColumn.DataType); Assert.Equal(DatoryUtils.VarCharDefaultLength, varCharDefaultColumn.DataLength); var boolColumn = tableColumns.FirstOrDefault(x => x.AttributeName == nameof(TestTableInfo.TypeBool)); Assert.NotNull(boolColumn); Assert.Equal(DataType.Boolean, boolColumn.DataType); var contentColumn = tableColumns.FirstOrDefault(x => x.AttributeName == nameof(TestTableInfo.Content)); Assert.NotNull(contentColumn); Assert.Equal(DataType.Text, contentColumn.DataType); var isLockedOutColumn = tableColumns.FirstOrDefault(x => x.AttributeName == "IsLockedOut"); Assert.NotNull(isLockedOutColumn); var lockedColumn = tableColumns.FirstOrDefault(x => x.AttributeName == nameof(TestTableInfo.Locked)); Assert.Null(lockedColumn); var isExists = DatoryUtils.IsTableExists(EnvUtils.DatabaseType, EnvUtils.ConnectionString, tableName); if (isExists) { DatoryUtils.DropTable(EnvUtils.DatabaseType, EnvUtils.ConnectionString, tableName); } DatoryUtils.CreateTable(EnvUtils.DatabaseType, EnvUtils.ConnectionString, tableName, tableColumns); }
public void End() { Skip.IfNot(EnvUtils.IntegrationTestMachine); DatoryUtils.DropTable(EnvUtils.DatabaseType, EnvUtils.ConnectionString, _repository.TableName); }