示例#1
0
        public void IndexSet_IsEqual_DifferentNonCountedFields_True()
        {
            IndexComparer.BusinessObjects.IndexSet isp3 = new IndexComparer.BusinessObjects.IndexSet();
            isp3.ServerName       = "Server 1";
            isp3.DatabaseName     = "Database 1";
            isp3.SchemaName       = "dbo";
            isp3.TableName        = "Table1";
            isp3.IndexName        = "Index3";
            isp3.IndexType        = "NONCLUSTERED";
            isp3.IndexIsUnique    = true;
            isp3.Columns          = "SomeColumn,SomeColumn2";
            isp3.IncludedColumns  = "SomeColumn4,SomeColumn3";
            isp3.HasFilter        = true;
            isp3.FilterDefinition = "(ID < 500)";

            IndexComparer.BusinessObjects.IndexSet iss4 = new IndexComparer.BusinessObjects.IndexSet();
            iss4.ServerName   = "Server 1";
            iss4.DatabaseName = "Database 1";
            iss4.SchemaName   = "dbo";
            iss4.TableName    = "Table1";
            iss4.IndexName    = "Index3";
            iss4.IndexType    = "HEAP";

            Assert.IsTrue(isp3.Equals(iss4));
            Assert.AreEqual(isp3.GetHashCode(), iss4.GetHashCode());
            Assert.IsFalse(isp3.TotallyEquals(iss4));
        }
示例#2
0
        public void IndexSet_UQ_CI_IsEqual_False()
        {
            IndexComparer.BusinessObjects.IndexSet isp3 = new IndexComparer.BusinessObjects.IndexSet();
            isp3.ServerName        = "Server 1";
            isp3.DatabaseName      = "Database 1";
            isp3.SchemaName        = "dbo";
            isp3.TableName         = "Table1";
            isp3.IndexName         = "Index3";
            isp3.IndexType         = "CLUSTERED";
            isp3.IndexIsUnique     = true;
            isp3.IsKeyConstraint   = true;
            isp3.KeyConstraintType = "PK";
            isp3.Columns           = "SomeColumn,SomeColumn2";
            isp3.IncludedColumns   = "SomeColumn4,SomeColumn3";
            isp3.HasFilter         = true;
            isp3.FilterDefinition  = "(ID < 500)";

            IndexComparer.BusinessObjects.IndexSet iss4 = new IndexComparer.BusinessObjects.IndexSet();
            iss4.ServerName       = "Server 1";
            iss4.DatabaseName     = "Database 1";
            iss4.SchemaName       = "dbo";
            iss4.TableName        = "Table1";
            iss4.IndexName        = "Index3";
            iss4.IndexType        = "CLUSTERED";
            iss4.IndexIsUnique    = true;
            iss4.Columns          = "SomeColumn,SomeColumn2";
            iss4.IncludedColumns  = "SomeColumn4,SomeColumn3";
            iss4.HasFilter        = true;
            iss4.FilterDefinition = "(ID < 500)";

            Assert.IsTrue(isp3.Equals(iss4));         //Server, database, schema, table, and index name match.
            Assert.AreEqual(isp3.GetHashCode(), iss4.GetHashCode());
            Assert.IsFalse(isp3.TotallyEquals(iss4)); //Key constraint does NOT match.
        }
示例#3
0
        public void IndexSet_UQ_NCI_IsEqual_False()
        {
            IndexComparer.BusinessObjects.IndexSet isp3 = new IndexComparer.BusinessObjects.IndexSet();
            isp3.ServerName = "Server 1";
            isp3.DatabaseName = "Database 1";
            isp3.SchemaName = "dbo";
            isp3.TableName = "Table1";
            isp3.IndexName = "Index3";
            isp3.IndexType = "NONCLUSTERED";
            isp3.IndexIsUnique = true;
            isp3.IsKeyConstraint = true;
            isp3.KeyConstraintType = "UQ";
            isp3.Columns = "SomeColumn,SomeColumn2";
            isp3.IncludedColumns = "SomeColumn4,SomeColumn3";
            isp3.HasFilter = true;
            isp3.FilterDefinition = "(ID < 500)";

            IndexComparer.BusinessObjects.IndexSet iss4 = new IndexComparer.BusinessObjects.IndexSet();
            iss4.ServerName = "Server 1";
            iss4.DatabaseName = "Database 1";
            iss4.SchemaName = "dbo";
            iss4.TableName = "Table1";
            iss4.IndexName = "Index3";
            iss4.IndexType = "NONCLUSTERED";
            iss4.IndexIsUnique = true;
            iss4.Columns = "SomeColumn,SomeColumn2";
            iss4.IncludedColumns = "SomeColumn4,SomeColumn3";
            iss4.HasFilter = true;
            iss4.FilterDefinition = "(ID < 500)";

            Assert.IsTrue(isp3.Equals(iss4));       //Server, database, schema, table, and index name match.
            Assert.AreEqual(isp3.GetHashCode(), iss4.GetHashCode());
            Assert.IsFalse(isp3.TotallyEquals(iss4));   //Key constraint does NOT match.
        }
示例#4
0
        public void IndexSet_IsTotallyEqual_IndexTypeDiffers_False()
        {
            IndexComparer.BusinessObjects.IndexSet isp3 = new IndexComparer.BusinessObjects.IndexSet();
            isp3.ServerName = "Server 1";
            isp3.DatabaseName = "Database 1";
            isp3.SchemaName = "dbo";
            isp3.TableName = "Table1";
            isp3.IndexName = "Index3";
            isp3.IndexType = "NONCLUSTERED";
            isp3.IndexIsUnique = true;
            isp3.Columns = "SomeColumn,SomeColumn2";
            isp3.IncludedColumns = "SomeColumn4,SomeColumn3";
            isp3.HasFilter = true;
            isp3.FilterDefinition = "(ID < 500)";

            IndexComparer.BusinessObjects.IndexSet iss4 = new IndexComparer.BusinessObjects.IndexSet();
            iss4.ServerName = "Server 1";
            iss4.DatabaseName = "Database 1";
            iss4.SchemaName = "dbo";
            iss4.TableName = "Table1";
            iss4.IndexName = "Index3";
            iss4.IndexType = "CLUSTERED";
            iss4.IndexIsUnique = true;
            iss4.Columns = "SomeColumn,SomeColumn2";
            iss4.IncludedColumns = "SomeColumn4,SomeColumn3";
            iss4.HasFilter = true;
            iss4.FilterDefinition = "(ID < 500)";

            Assert.IsTrue(isp3.Equals(iss4));
            Assert.AreEqual(isp3.GetHashCode(), iss4.GetHashCode());
            Assert.IsFalse(isp3.TotallyEquals(iss4));
        }