Esempio n. 1
0
        public void CreateCreateIndexOperation_creates_operation_and_its_inverse()
        {
            var index = new ConsolidatedIndex("raS", "tut1", new IndexAttribute("pong", 0)
            {
                IsClustered = true
            });

            index.Add("tut2", new IndexAttribute("pong", 1));

            var operation = index.CreateCreateIndexOperation();

            Assert.Equal("raS", operation.Table);
            Assert.Equal("pong", operation.Name);
            Assert.Equal(new List <string> {
                "tut1", "tut2"
            }, operation.Columns);
            Assert.False(operation.IsUnique);
            Assert.True(operation.IsClustered);

            var inverse = (DropIndexOperation)operation.Inverse;

            Assert.Equal("raS", inverse.Table);
            Assert.Equal("pong", inverse.Name);
            Assert.Equal(new List <string> {
                "tut1", "tut2"
            }, inverse.Columns);
        }
Esempio n. 2
0
        public void CreateCreateIndexOperation_creates_operation_and_its_inverse_for_unnamed_index()
        {
            var index = new ConsolidatedIndex("raS", "tut", new IndexAttribute {
                IsUnique = true
            });

            var operation = index.CreateCreateIndexOperation();

            Assert.Equal("raS", operation.Table);
            Assert.Equal("IX_tut", operation.Name);
            Assert.Equal(new List <string> {
                "tut"
            }, operation.Columns);
            Assert.True(operation.IsUnique);
            Assert.False(operation.IsClustered);

            var inverse = (DropIndexOperation)operation.Inverse;

            Assert.Equal("raS", inverse.Table);
            Assert.Equal("IX_tut", inverse.Name);
            Assert.Equal(new List <string> {
                "tut"
            }, inverse.Columns);
        }
        public void CreateCreateIndexOperation_creates_operation_and_its_inverse()
        {
            var index = new ConsolidatedIndex("raS", "tut1", new IndexAttribute("pong", 0) { IsClustered = true });
            index.Add("tut2", new IndexAttribute("pong", 1));

            var operation = index.CreateCreateIndexOperation();

            Assert.Equal("raS", operation.Table);
            Assert.Equal("pong", operation.Name);
            Assert.Equal(new List<string> { "tut1", "tut2" }, operation.Columns);
            Assert.False(operation.IsUnique);
            Assert.True(operation.IsClustered);

            var inverse = (DropIndexOperation)operation.Inverse;

            Assert.Equal("raS", inverse.Table);
            Assert.Equal("pong", inverse.Name);
            Assert.Equal(new List<string> { "tut1", "tut2" }, inverse.Columns);
        }
        public void CreateCreateIndexOperation_creates_operation_and_its_inverse_for_unnamed_index()
        {
            var index = new ConsolidatedIndex("raS", "tut", new IndexAttribute { IsUnique = true });

            var operation = index.CreateCreateIndexOperation();

            Assert.Equal("raS", operation.Table);
            Assert.Equal("IX_tut", operation.Name);
            Assert.Equal(new List<string> { "tut" }, operation.Columns);
            Assert.True(operation.IsUnique);
            Assert.False(operation.IsClustered);

            var inverse = (DropIndexOperation)operation.Inverse;

            Assert.Equal("raS", inverse.Table);
            Assert.Equal("IX_tut", inverse.Name);
            Assert.Equal(new List<string> { "tut" }, inverse.Columns);
        }