Exemple #1
0
        public void Dispatches_visitor()
        {
            var addForeignKeyOperation = new AddForeignKeyOperation(
                "dbo.MyTable", "MyFK", new[] { "Foo", "Bar" },
                "dbo.MyTable2", new[] { "Foo2", "Bar2" },
                cascadeDelete: true);
            var mockVisitor = MigrationsTestHelpers.MockSqlGenerator();
            var builder     = new Mock <SqlBatchBuilder>();

            addForeignKeyOperation.GenerateSql(mockVisitor.Object, builder.Object);

            mockVisitor.Verify(g => g.Generate(addForeignKeyOperation, builder.Object), Times.Once());
        }
        public void Dispatches_visitor()
        {
            var addForeignKeyOperation = new AddForeignKeyOperation(
                "dbo.MyTable", "MyFK", new[] { "Foo", "Bar" },
                "dbo.MyTable2", new[] { "Foo2", "Bar2" },
                cascadeDelete: true);
            var mockVisitor = new Mock <MigrationOperationSqlGenerator>(new RelationalTypeMapper());
            var builder     = new Mock <IndentedStringBuilder>();

            addForeignKeyOperation.GenerateSql(mockVisitor.Object, builder.Object);

            mockVisitor.Verify(g => g.Generate(addForeignKeyOperation, builder.Object), Times.Once());
        }