The rules are:
- It must be a unit test (so don't touch the file system).
- The public signature for
CodeUnderTest
must not be changed.can be extended not reduced - You're allowed to use DI/your favorite mocking framework.
- You can only add code where you see /**/.
[Test]
public void Test()
{
/**/
var text = CodeUnderTest.GetUpperText("foo.txt" /**/);
Assert.That(text, Is.EqualTo("BAR"));
/**/
}
public class CodeUnderTest
{
/**/
public static string GetUpperText(string path /**/)
{
var text = File.ReadAllText(path);
return text.ToUpperInvariant();
}
/**/
}
Please comment below or tweet me @jcansdale.
Here you go; no need to change the test: