Hi I have a simple method, where It takes a string as parameter (domainname//firstname.lastname) and takes out (domainname//) and returns string as just firstname.lastname.
I need to unit test for the following case.
check for single slash (domainname/firstname.lastname)
Check for empty string
Check for null value
Check wheather the string contains // or not
I wrote the following but it does not make any sense to me, coz this is completely wrong.
#region Checking for null value
[TestMethod()]
public void CheckForNullValueTest()
{
string expected = "";
string source = @"domainname//hari.gillala";
string actual = Function.RemoveSlash(source);
assert.Equal(expected, actual);
}
#endregion
#region Checking for empty
[TestMethod()]
public void CheckForEmptyValueTest()
{
string expected = string.empty;
string source = @"domainname//hari.gillala";
string actual = Function.RemoveSlash(source);
assert.Equal(expected, actual);
}
#endregion
#region Checking for singleslash
[TestMethod()]
public void CheckForSingleSlashTest()
{
string expected = @"domainname/hari.gillala";
string source = "domainname//hari.gillala";
string actual = Function.RemoveSlash(source);
assert.Equal(expected, actual);
}
#endregion
#region Checking for Doubleslash
[TestMethod()]
public void CheckForDoubleSlashTest()
{
string expected = @"domainname//hari.gillala";
string source = "domainname//hari.gillala";
string actual = Function.RemoveSlash(source);
assert.Equal(expected, actual);
}
#endregion
Could any one correct me, where I am wrong. And help me to write the unit test for all the cases for the function.
Thank you