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

Popular posts from this blog

actionscript 3 - TweenLite does not work with object -

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

c# - Global Variables vs. ASP.NET Session State -