Q
Q
Quip Quip2016-04-05 00:21:39
C++ / C#
Quip Quip, 2016-04-05 00:21:39

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

1 answer(s)
A
Alexander Ananiev, 2016-04-05
@QuipQuip

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 question

Ask a Question

731 491 924 answers to any question