public void Dispatches_visitor() { var renameColumnOperation = new RenameColumnOperation("dbo.MyTable", "Foo", "Foo2"); var mockVisitor = new Mock<MigrationOperationSqlGenerator>(new RelationalTypeMapper()); var builder = new Mock<IndentedStringBuilder>(); renameColumnOperation.GenerateSql(mockVisitor.Object, builder.Object); mockVisitor.Verify(g => g.Generate(renameColumnOperation, builder.Object), Times.Once()); }
public void Create_and_initialize_operation() { var renameColumnOperation = new RenameColumnOperation("dbo.MyTable", "Foo", "Foo2"); Assert.Equal("dbo.MyTable", renameColumnOperation.TableName); Assert.Equal("Foo", renameColumnOperation.ColumnName); Assert.Equal("Foo2", renameColumnOperation.NewColumnName); Assert.False(renameColumnOperation.IsDestructiveChange); }
public override void Generate(RenameColumnOperation renameColumnOperation, IndentedStringBuilder stringBuilder) { Check.NotNull(renameColumnOperation, "renameColumnOperation"); stringBuilder .Append("EXECUTE sp_rename @objname = N'") .Append(EscapeLiteral(renameColumnOperation.TableName)) .Append(".") .Append(EscapeLiteral(renameColumnOperation.ColumnName)) .Append("', @newname = N") .Append(DelimitLiteral(renameColumnOperation.NewColumnName)) .Append(", @objtype = N'COLUMN'"); }
public virtual void Visit([NotNull] RenameColumnOperation renameColumnOperation, [NotNull] TContext context) { VisitDefault(renameColumnOperation, context); }
public override void Generate(RenameColumnOperation renameColumnOperation, IndentedStringBuilder stringBuilder) { // TODO: Rebuild table throw new NotImplementedException(); }