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 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 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()); }