private static int CountRowsWith(string countSql, IMigrationProcessor processor, params object[] args) { var result = processor.Read(countSql, args); Assert.That(result.Tables.Count, Is.GreaterThan(0)); var table = result.Tables[0]; Assert.That(table.Rows.Count, Is.GreaterThan(0)); var row = table.Rows[0]; Assert.IsTrue(table.Columns.Contains("TheCount")); return(Convert.ToInt32(row["TheCount"])); }
private static void AssertThatFieldHasCorrectTypeAndSubType(string fieldName, string tableName, IMigrationProcessor processor, int expectedFieldType, int expectedFieldSubType) { var sql = "select RDB$FIELD_TYPE fieldType, RDB$FIELD_SUB_TYPE subType from RDB$RELATION_FIELDS rf " + "inner join RDB$FIELDS f on rf.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME where rf.RDB$FIELD_NAME = '" + fieldName.ToUpper() + "' " + "and rf.RDB$RELATION_NAME = '" + tableName.ToUpper() + "'"; var result = processor.Read(sql); Assert.That(result.Tables.Count, Is.GreaterThan(0), "Unable to query schema for table '" + tableName + "'"); var table = result.Tables[0]; Assert.That(table.Rows.Count, Is.GreaterThan(0), "Unable to query schema for table '" + tableName + "'"); var row = table.Rows[0]; var fieldType = row["fieldType"]; var fieldSubType = row["subType"]; Assert.AreEqual(expectedFieldType, fieldType, "Field type mismatch"); Assert.AreEqual(expectedFieldSubType, fieldSubType, "Field subtype mismatch"); }