public void RemoveFirstAndLastCharacter_ManyDifferentCharacters_StartAndEndCharIsRemoved() { //Arrange var mod = new SqlModifier(); //Act var t = mod.RemoveFirstAndLastCharacter("P_b[c2cpS7~K+c=r9n4vwMYZX/g_7MVkCJ6t6bb{9?UW21hG,o"); //Assert Assert.AreEqual("_b[c2cpS7~K+c=r9n4vwMYZX/g_7MVkCJ6t6bb{9?UW21hG,", t); }
public void RemoveFirstAndLastCharacter_Letters_StartAndEndCharIsRemoved() { //Arrange var mod = new SqlModifier(); //Act var t = mod.RemoveFirstAndLastCharacter("eaglebrain"); //Assert Assert.AreEqual("aglebrai", t); }
public string AddForeignKeyConstraint(string tableName, string fkName, string foreignTableName, string foreignKeyName, string onDeleteOption, string onUpdateOption) { //ALTER TABLE products //ADD FOREIGN KEY fk_vendor(vdr_id) //REFERENCES vendors(vdr_id) //ON DELETE NO ACTION //ON UPDATE CASCADE; var foreignTableWithoutQuotes = new SqlModifier().RemoveFirstAndLastCharacter(foreignTableName); var l1 = AlterTable + " " + tableName + " "; var l2 = "ADD FOREIGN KEY fk_" + foreignTableWithoutQuotes + "(" + fkName + ") "; var l3 = "REFERENCES " + foreignTableName + "(" + foreignKeyName + ") "; var l4 = "ON DELETE " + onDeleteOption + " "; var l5 = "ON UPDATE " + onUpdateOption; return(l1 + l2 + l3 + l4 + l5); }