コード例 #1
0
        public void Dispatches_visitor()
        {
            var createIndexOperation = new CreateIndexOperation(
                "dbo.MyTable", "MyIndex", new[] { "Foo", "Bar" },
                isUnique: true, isClustered: true);
            var mockVisitor = new Mock<MigrationOperationSqlGenerator>(new RelationalTypeMapper());
            var builder = new Mock<IndentedStringBuilder>();
            createIndexOperation.GenerateSql(mockVisitor.Object, builder.Object);

            mockVisitor.Verify(g => g.Generate(createIndexOperation, builder.Object), Times.Once());
        }
コード例 #2
0
        public void Create_and_initialize_operation()
        {
            var createIndexOperation = new CreateIndexOperation(
                "dbo.MyTable", "MyIndex", new[] { "Foo", "Bar" },
                isUnique: true, isClustered: true);

            Assert.Equal("dbo.MyTable", createIndexOperation.TableName);
            Assert.Equal("MyIndex", createIndexOperation.IndexName);
            Assert.Equal(new[] { "Foo", "Bar" }, createIndexOperation.ColumnNames);
            Assert.True(createIndexOperation.IsUnique);
            Assert.True(createIndexOperation.IsClustered);
            Assert.False(createIndexOperation.IsDestructiveChange);
        }
コード例 #3
0
 public virtual void Visit([NotNull] CreateIndexOperation createIndexOperation, [NotNull] TContext context)
 {
     VisitDefault(createIndexOperation, context);
 }