想象一下:我想创建新功能:扫描文件中的病毒。
使用 TDD 我想进行以下测试:
ScanningAnInfectedFileReturnsFalse
扫描ACleanFileReturnsTrue
在代码中我想创建这个函数:
/// <summary>
///
/// </summary>
/// <param name="fullFileName">The File To Scan</param>
/// <returns>True: File is clean, False: File contains virus</returns>
public static bool ScanFile(string fullFileName)
{
//TODO: Scan the given FullFileName
throw new NotImplementedException();
}
我的问题:如何使用给定的函数实现这两个测试?我认为应该重构该功能以使其可测试?