Answer the question
In order to leave comments, you need to log in
Why is the unit test not working?
I wrote a simple test that checks for null, but for some reason it does not work.
There is a class:
class StringHelper
public static string Cut(string text, int tLength)
{
if(text.Length>twittLength)
{
text = text.Remove(twittLength);
}
return text;
}
I am writing a test for the Cut method:
[TestMethod]
public void TestNullText()
{
var text = StringHelper.Cut(null, default(int));
Assert.IsNull(text);
}
it is not executed, I can not understand what the error is, please tell me.
Answer the question
In order to leave comments, you need to log in
Cohenically, the test will fail with an exception, because there is no check for null in the desired function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question