c# - Test cases to check if one string is present in another -
i had question in interview write test cases test function checks if 1 string present in didn't quite expect question pop in interview developer position, yesterday got heads on-site visit same company wanted pointers testing folks here idea (before head there) go answering type of questions. skeleton provided function ask me test it.
public static boolean checksubstring(string str1, string str2) { //first string source // second string reference if(str1.contains(str2)) return true; else return false; }
thanks reading. forward replies eagerly.
just 1 tip: consider part: str1.contains(str2)
, when result in true
, when in false
, needed make throw exception.
that test cases.
Comments
Post a Comment