public void Test_Do_ReturnsCr_WhenFileContainsOnlyCr() { // テスト用のファイルを用意 var fileName = MethodBase.GetCurrentMethod().Name; var filePath = Path.Combine(this.DirectoryPath, fileName); var fileEncoding = Encoding.UTF8; using (var stream = File.Create(filePath)) using (var writer = new StreamWriter(stream, fileEncoding)) { var content = "line1 \r line2 \r line3 \r"; writer.Write(content); writer.Flush(); } // テスト対象の処理を実行 var method = new NewLineScoutingMethod(); var actual = method.Do(new ScoutingClue() { FilePath = filePath, Encoding = fileEncoding }); // テスト結果を検証 Assert.AreEqual("CR", actual); }
public void Test_Do_ReturnsCr_WhenFileIsBinary() { // テスト対象の処理を実行 var method = new NewLineScoutingMethod(); var actual = method.Do(new ScoutingClue() { Encoding = null }); // テスト結果を検証 Assert.AreEqual("-", actual); }