Solution Review: Adding an Automated Test
Review the solution for implementing xUnit tests.
We'll cover the following...
We'll cover the following...
The completed solution is presented in the following code playground:
namespace MainApp;
public class TextProcessor
{
public int CountNotWhitespaceCharacters(string? text)
{
if (string.IsNullOrWhiteSpace(text))
return 0;
int count = 0;
foreach (var character in text.Trim())
{
if (char.IsWhiteSpace(character))
continue;
count++;
}
return count;
}
}Completed solution
Line 5: We mark our method with the
[Theory]attribute ...