public void Different_Object_Equals_Test()
        {
            String s = "ABCD";

            var table = new Table(typeof(SubjectClass), null);

            Assert.IsFalse(table.BasicFieldsEqual(s));
        }
        public void DifferentCatalogue_SameSchema_Equals_Test()
        {
            const string catalogue1 = "catalogue1ABC";
            const string catalogue2 = "catalogue2ABC";
            const string schema = "schema1ABC";
            const string tableName = "primaryTableNameABC";

            var tableAttribute1 = new TableAttribute(catalogue1, schema, tableName);
            var table1 = new Table(tableAttribute1);

            var tableAttribute2 = new TableAttribute(catalogue2, schema, tableName);
            var table2 = new Table(tableAttribute2);

            Assert.IsTrue(table1.BasicFieldsEqual(table2));
        }
        public void DifferentSchema_NoTableAttribute_DoesNotEqual_Test()
        {
            const string schema1 = "schema1ABC";
            const string schema2 = "schema2ABC";
            const string primaryTableName = "primaryTableNameABC";
            const string primaryKeyName = "primaryKeyNameABC";

            var fkAttribute1 = new ForeignKeyAttribute(schema1, primaryTableName, primaryKeyName);
            var table1 = new Table(fkAttribute1, null);

            var fkAttribute2 = new ForeignKeyAttribute(schema2, primaryTableName, primaryKeyName);
            var table2 = new Table(fkAttribute2, null);

            Assert.IsFalse(table1.BasicFieldsEqual(table2));
        }
 public TableTypeCacheException(string ambigousTableSearchConditionsMessage, Table table, Type ambigousType1,
     Type ambigousType2)
     : base(string.Format(ambigousTableSearchConditionsMessage, table, ambigousType1, ambigousType2))
 {
 }
 public TableTypeCacheException(string errorGettingDefinedTypeMessage, Table table)
     : base(string.Format(errorGettingDefinedTypeMessage, table))
 {
 }
        public void ForeignKeyAttribute_Constructor_Test()
        {
            // Arrange

            const string schema = "schemaABC";
            const string primaryTableName = "primaryTableNameABC";
            const string primaryKeyName = "primaryKeyNameABC";

            var fkAttribute = new ForeignKeyAttribute(schema, primaryTableName, primaryKeyName);

            // Act

            var table = new Table(fkAttribute, null);

            // Assert

            Assert.IsFalse(table.HasTableAttribute);
            Assert.IsFalse(table.HasCatalogueName);
            Assert.IsNull(table.CatalogueName);
            Assert.AreEqual(schema, table.Schema);
            Assert.AreEqual(primaryTableName, table.TableName);

            Assert.AreEqual(schema.GetHashCode() ^ primaryTableName.GetHashCode(), table.GetHashCode());
        }
        public void Type_Constructor_Test()
        {
            // Arrange

            const string defaultSchema = "schema123";

            // Act

            var table = new Table(typeof(SubjectClass), defaultSchema);

            // Assert

            Assert.IsFalse(table.HasTableAttribute);
            Assert.IsNull(table.CatalogueName);
            Assert.AreEqual(defaultSchema, table.Schema);
            Assert.AreEqual(nameof(SubjectClass), table.TableName);

            Assert.AreEqual(defaultSchema.GetHashCode() ^ nameof(SubjectClass).GetHashCode(), table.GetHashCode());
        }
        public void TableAttribute_Constructor_Test()
        {
            // Arrange

            const string catalogueName = "catalogueABC";
            const string schema = "schemaABC";
            const string tableName = "tableNameABC";

            var tableAttribute = new TableAttribute(catalogueName, schema, tableName);

            // Act

            var table = new Table(tableAttribute);

            // Assert

            Assert.IsTrue(table.HasTableAttribute);
            Assert.AreEqual(catalogueName, table.CatalogueName);
            Assert.AreEqual(schema, table.Schema);
            Assert.AreEqual(tableName, table.TableName);

            Assert.AreEqual(schema.GetHashCode() ^ tableName.GetHashCode(), table.GetHashCode());
        }
        public void SameCatalogue_SameSchema_DifferentTable_DoesNotEqual_Test()
        {
            const string catalogue = "catalogue2ABC";
            const string schema = "schema1ABC";
            const string tableName1 = "primaryTableName1ABC";
            const string tableName2 = "primaryTableName2ABC";

            var tableAttribute1 = new TableAttribute(catalogue, schema, tableName1);
            var table1 = new Table(tableAttribute1);

            var tableAttribute2 = new TableAttribute(catalogue, schema, tableName2);
            var table2 = new Table(tableAttribute2);

            Assert.IsFalse(table1.BasicFieldsEqual(table2));
        }
        public void NoSchemaInput_NoCatalogueInput_Equals_Test()
        {
            var table1 = new Table(typeof(SubjectClass), null);
            var table2 = new Table(typeof(SubjectClass), null);

            Assert.IsTrue(table1.BasicFieldsEqual(table2));
        }
        public void InputForTryGet_NoTableAttribute_Equals_Test()
        {
            const string schema = "schemaABC";
            const string primaryTableName = "primaryTableNameABC";
            const string primaryKeyName = "primaryKeyNameABC";

            var fkAttribute1 = new ForeignKeyAttribute(schema, primaryTableName, primaryKeyName);
            var table1 = new Table(fkAttribute1, null);

            var fkAttribute2 = new ForeignKeyAttribute(schema, primaryTableName, primaryKeyName);
            var table2 = new Table(fkAttribute2, null);

            Assert.IsTrue(table1.BasicFieldsEqual(table2));
        }