I have a unit test with different test cases (ie exactly the same code gets run but with different parameters).
One 3 of the test cases take around 26ms but one consistently takes around 500ms
the following is the if statement which gets run
public Boolean Test1()
{
bool invalid = false;
if (!string.IsNullOrEmpty(String1)&&!string.IsNullOrEmpty(String2))
{
invalid = true;
}
return invalid;
}
Now the case that takes the long time is setup with string1 being set to a valid string and string2 being set to null.
The other cases are string1=null,string2=null and string1=null, string2=valid string and string1=valid string, string2=valid string.
Can anyone see why the one arrangement would take almost 20 times longer than the others?
Aucun commentaire:
Enregistrer un commentaire