OSDN Git Service

[SSTFormat] Version クラスに CreateVersionFromFile() を追加。
authorくまかみ工房 <kumakamikoubou@gmail.com>
Tue, 3 Jan 2017 12:52:28 +0000 (21:52 +0900)
committerくまかみ工房 <kumakamikoubou@gmail.com>
Tue, 3 Jan 2017 12:52:28 +0000 (21:52 +0900)
SSTFormat.v1/v2.スコア クラスの '行を読み込む()' を private 化。バージョンによって前処理の内容に左右されるのはよろしくないため。

SSTFormat/Version.cs
SSTFormat/v1/スコア.cs
SSTFormat/v2/スコア.cs
SSTFormatTests/SSTFormatTests.csproj
SSTFormatTests/VersionTests.cs [new file with mode: 0644]
SSTFormatTests/v1/スコアTests.cs
SSTFormatTests/v2/スコアTests.cs [deleted file]

index 829e29c..fde31fa 100644 (file)
@@ -67,6 +67,14 @@ namespace SSTFormat
                /// <param name="path">
                ///             SSTF ファイルのパス。
                /// </param>
+               /// <returns>
+               ///             取得された SSTF バージョン。
+               ///             SSTF ファイルにバージョンの記載がない場合には、1.0.0.0 が返される。
+               /// </returns>
+               /// <remarks>
+               ///             SSTFVersion の指定は、先頭行でのみ可能。
+               ///             例: "SSTFVersion 1.0.0.0"
+               /// </remarks>
                public static Version CreateVersionFromFile( string path )
                {
                        if( false == File.Exists( path ) )
@@ -74,12 +82,17 @@ namespace SSTFormat
 
                        using( var reader = new StreamReader( path, Encoding.UTF8 ) )
                        {
-                               // 先頭行を読み込む。
-                               string line = reader.ReadLine();
+                               string バージョン文字列 = "1.0.0.0";    // 既定のバージョン
+                               string トークン = "SSTFVersion";
 
-                       }
+                               // 最初の行に指定がなかったら、既定のバージョンとする。
+                               string 先頭行 = reader.ReadLine();
 
-                       return null;
+                               if( 先頭行.StartsWith( トークン ) )
+                                       バージョン文字列 = 先頭行.Substring( トークン.Length ).Trim();
+
+                               return new Version( バージョン文字列 );
+                       }
                }
 
                /// <summary>
index c5fde94..17dc0ea 100644 (file)
@@ -168,40 +168,6 @@ namespace SSTFormat.v1
                }
 
                /// <summary>
-               ///             Stream から1行読み込み、コメントや改行等の前処理を行ってから返す。
-               /// </summary>
-               /// <param name="reader">
-               ///             行の読み込み元。読み込んだ分、ポジションは進められる。
-               /// </param>
-               /// <returns>
-               ///             読み込んで、コメントや改行等の前処理を適用したあとの行を返す。
-               ///             reader が EOF だった場合には null を返す。
-               /// </returns>
-               public static string 行を読み込む( StreamReader reader )
-               {
-                       if( reader.EndOfStream )
-                               return null;
-
-                       // 1行読み込む。
-                       string 行 = reader.ReadLine();
-
-                       // (1) 改行とTABを空白文字に変換し、先頭末尾の空白を削除する。
-                       行 = 行.Replace( Environment.NewLine, " " );
-                       行 = 行.Replace( '\t', ' ' );
-                       行 = 行.Trim();
-
-                       // (2) 行中の '#' 以降はコメントとして除外する。
-                       int 区切り位置 = 行.IndexOf( '#' );
-                       if( 0 <= 区切り位置 )
-                       {
-                               行 = 行.Substring( 0, 区切り位置 );
-                               行 = 行.Trim();
-                       }
-
-                       return 行;
-               }
-
-               /// <summary>
                ///             指定された曲データファイルを読み込む。
                ///             失敗すれば何らかの例外を発出する。
                /// </summary>
@@ -234,7 +200,7 @@ namespace SSTFormat.v1
                                {
                                        // 1行ずつ読み込む。
                                        行番号++;
-                                       string 行 = 行を読み込む( sr );
+                                       string 行 = this._行を読み込む( sr );
 
                                        if( 行.Nullまたは空である() )
                                                continue;
@@ -476,7 +442,7 @@ namespace SSTFormat.v1
 
                                                        #region " 小節番号を取得・設定。"
                                                        //-----------------
-                                                       string 小節番号文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref パラメータ );
+                                                       string 小節番号文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref パラメータ );
 
                                                        if( 小節番号文字列.Nullまたは空である() )
                                                        {
@@ -513,7 +479,7 @@ namespace SSTFormat.v1
                                                                        //-----------------
                                                                        パラメータ = パラメータ.Substring( 1 ).Trim();
 
-                                                                       string 小節長倍率文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref パラメータ );
+                                                                       string 小節長倍率文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref パラメータ );
                                                                        if( 小節長倍率文字列.Nullまたは空である() )
                                                                        {
                                                                                Log.ERROR( $"Part(小節番号)コマンドに小節長倍率の記述がありません。この属性をスキップします。[{行番号}行目]" );
@@ -655,7 +621,7 @@ namespace SSTFormat.v1
                                                                #region " チップ位置を取得する。"
                                                                //-----------------
                                                                int チップ位置 = 0;
-                                                               string 位置番号文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
+                                                               string 位置番号文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
                                                                chipTokens[ i ].Trim();
 
                                                                // 文法チェック。
@@ -695,7 +661,7 @@ namespace SSTFormat.v1
                                                                                #region " 音量 "
                                                                                //-----------------
                                                                                chipTokens[ i ] = chipTokens[ i ].Substring( 1 ).Trim();
-                                                                               string 音量文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
+                                                                               string 音量文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
                                                                                chipTokens[ i ].Trim();
 
                                                                                int チップ音量 = 0;
@@ -1050,7 +1016,7 @@ namespace SSTFormat.v1
 
                                                                                                chipTokens[ i ] = chipTokens[ i ].Substring( 1 ).Trim();
 
-                                                                                               string BPM文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
+                                                                                               string BPM文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
                                                                                                chipTokens[ i ].Trim();
 
                                                                                                if( BPM文字列.Nullまたは空である() )
@@ -1264,7 +1230,7 @@ namespace SSTFormat.v1
                                        // 1行ずつ読み込む。
 
                                        行番号++;
-                                       string 行 = 行を読み込む( sr );
+                                       string 行 = this._行を読み込む( sr );
 
                                        if( 行.Nullまたは空である() )
                                                continue;
@@ -1645,7 +1611,7 @@ namespace SSTFormat.v1
                ///             取出文字列の先頭にある数字(小数点も有効)の連続した部分を取り出して、戻り値として返す。
                ///             また、取出文字列から取り出した数字文字列部分を除去した文字列を再度格納する。
                /// </summary>
-               protected string 指定された文字列の先頭から数字文字列を取り出す( ref string 取出文字列 )
+               private string _指定された文字列の先頭から数字文字列を取り出す( ref string 取出文字列 )
                {
                        int 桁数 = 0;
                        while( ( 桁数 < 取出文字列.Length ) && ( char.IsDigit( 取出文字列[ 桁数 ] ) || 取出文字列[ 桁数 ] == '.' ) )
@@ -1659,5 +1625,39 @@ namespace SSTFormat.v1
 
                        return 数字文字列;
                }
+
+               /// <summary>
+               ///             Stream から1行読み込み、コメントや改行等の前処理を行ってから返す。
+               /// </summary>
+               /// <param name="reader">
+               ///             行の読み込み元。読み込んだ分、ポジションは進められる。
+               /// </param>
+               /// <returns>
+               ///             読み込んで、コメントや改行等の前処理を適用したあとの行を返す。
+               ///             reader が EOF だった場合には null を返す。
+               /// </returns>
+               private string _行を読み込む( StreamReader reader )
+               {
+                       if( reader.EndOfStream )
+                               return null;
+
+                       // 1行読み込む。
+                       string 行 = reader.ReadLine();
+
+                       // (1) 改行とTABを空白文字に変換し、先頭末尾の空白を削除する。
+                       行 = 行.Replace( Environment.NewLine, " " );
+                       行 = 行.Replace( '\t', ' ' );
+                       行 = 行.Trim();
+
+                       // (2) 行中の '#' 以降はコメントとして除外する。
+                       int 区切り位置 = 行.IndexOf( '#' );
+                       if( 0 <= 区切り位置 )
+                       {
+                               行 = 行.Substring( 0, 区切り位置 );
+                               行 = 行.Trim();
+                       }
+
+                       return 行;
+               }
        }
 }
index c6e4602..5715db8 100644 (file)
@@ -168,40 +168,6 @@ namespace SSTFormat.v2
                }
 
                /// <summary>
-               ///             Stream から1行読み込み、コメントや改行等の前処理を行ってから返す。
-               /// </summary>
-               /// <param name="reader">
-               ///             行の読み込み元。読み込んだ分、ポジションは進められる。
-               /// </param>
-               /// <returns>
-               ///             読み込んで、コメントや改行等の前処理を適用したあとの行を返す。
-               ///             reader が EOF だった場合には null を返す。
-               /// </returns>
-               public static string 行を読み込む( StreamReader reader )
-               {
-                       if( reader.EndOfStream )
-                               return null;
-
-                       // 1行読み込む。
-                       string 行 = reader.ReadLine();
-
-                       // (1) 改行とTABを空白文字に変換し、先頭末尾の空白を削除する。
-                       行 = 行.Replace( Environment.NewLine, " " );
-                       行 = 行.Replace( '\t', ' ' );
-                       行 = 行.Trim();
-
-                       // (2) 行中の '#' 以降はコメントとして除外する。
-                       int 区切り位置 = 行.IndexOf( '#' );
-                       if( 0 <= 区切り位置 )
-                       {
-                               行 = 行.Substring( 0, 区切り位置 );
-                               行 = 行.Trim();
-                       }
-
-                       return 行;
-               }
-
-               /// <summary>
                ///             指定された曲データファイルを読み込む。
                ///             失敗すれば何らかの例外を発出する。
                /// </summary>
@@ -234,7 +200,7 @@ namespace SSTFormat.v2
                                {
                                        // 1行ずつ読み込む。
                                        行番号++;
-                                       string 行 = 行を読み込む( sr );
+                                       string 行 = this._行を読み込む( sr );
 
                                        if( 行.Nullまたは空である() )
                                                continue;
@@ -443,7 +409,7 @@ namespace SSTFormat.v2
 
                                                        #region " 小節番号を取得・設定。"
                                                        //-----------------
-                                                       string 小節番号文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref パラメータ );
+                                                       string 小節番号文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref パラメータ );
 
                                                        if( 小節番号文字列.Nullまたは空である() )
                                                        {
@@ -480,7 +446,7 @@ namespace SSTFormat.v2
                                                                        //-----------------
                                                                        パラメータ = パラメータ.Substring( 1 ).Trim();
 
-                                                                       string 小節長倍率文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref パラメータ );
+                                                                       string 小節長倍率文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref パラメータ );
                                                                        if( 小節長倍率文字列.Nullまたは空である() )
                                                                        {
                                                                                Log.ERROR( $"Part(小節番号)コマンドに小節長倍率の記述がありません。この属性をスキップします。[{行番号}行目]" );
@@ -622,7 +588,7 @@ namespace SSTFormat.v2
                                                                #region " チップ位置を取得する。"
                                                                //-----------------
                                                                int チップ位置 = 0;
-                                                               string 位置番号文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
+                                                               string 位置番号文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
                                                                chipTokens[ i ].Trim();
 
                                                                // 文法チェック。
@@ -662,7 +628,7 @@ namespace SSTFormat.v2
                                                                                #region " 音量 "
                                                                                //-----------------
                                                                                chipTokens[ i ] = chipTokens[ i ].Substring( 1 ).Trim();
-                                                                               string 音量文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
+                                                                               string 音量文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
                                                                                chipTokens[ i ].Trim();
 
                                                                                int チップ音量 = 0;
@@ -1017,7 +983,7 @@ namespace SSTFormat.v2
 
                                                                                                chipTokens[ i ] = chipTokens[ i ].Substring( 1 ).Trim();
 
-                                                                                               string BPM文字列 = this.指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
+                                                                                               string BPM文字列 = this._指定された文字列の先頭から数字文字列を取り出す( ref chipTokens[ i ] );
                                                                                                chipTokens[ i ].Trim();
 
                                                                                                if( BPM文字列.Nullまたは空である() )
@@ -1231,7 +1197,7 @@ namespace SSTFormat.v2
                                        // 1行ずつ読み込む。
 
                                        行番号++;
-                                       string 行 = 行を読み込む( sr );
+                                       string 行 = this._行を読み込む( sr );
 
                                        if( 行.Nullまたは空である() )
                                                continue;
@@ -1612,7 +1578,7 @@ namespace SSTFormat.v2
                ///             取出文字列の先頭にある数字(小数点も有効)の連続した部分を取り出して、戻り値として返す。
                ///             また、取出文字列から取り出した数字文字列部分を除去した文字列を再度格納する。
                /// </summary>
-               protected string 指定された文字列の先頭から数字文字列を取り出す( ref string 取出文字列 )
+               private string _指定された文字列の先頭から数字文字列を取り出す( ref string 取出文字列 )
                {
                        int 桁数 = 0;
                        while( ( 桁数 < 取出文字列.Length ) && ( char.IsDigit( 取出文字列[ 桁数 ] ) || 取出文字列[ 桁数 ] == '.' ) )
@@ -1626,5 +1592,39 @@ namespace SSTFormat.v2
 
                        return 数字文字列;
                }
+
+               /// <summary>
+               ///             Stream から1行読み込み、コメントや改行等の前処理を行ってから返す。
+               /// </summary>
+               /// <param name="reader">
+               ///             行の読み込み元。読み込んだ分、ポジションは進められる。
+               /// </param>
+               /// <returns>
+               ///             読み込んで、コメントや改行等の前処理を適用したあとの行を返す。
+               ///             reader が EOF だった場合には null を返す。
+               /// </returns>
+               private string _行を読み込む( StreamReader reader )
+               {
+                       if( reader.EndOfStream )
+                               return null;
+
+                       // 1行読み込む。
+                       string 行 = reader.ReadLine();
+
+                       // (1) 改行とTABを空白文字に変換し、先頭末尾の空白を削除する。
+                       行 = 行.Replace( Environment.NewLine, " " );
+                       行 = 行.Replace( '\t', ' ' );
+                       行 = 行.Trim();
+
+                       // (2) 行中の '#' 以降はコメントとして除外する。
+                       int 区切り位置 = 行.IndexOf( '#' );
+                       if( 0 <= 区切り位置 )
+                       {
+                               行 = 行.Substring( 0, 区切り位置 );
+                               行 = 行.Trim();
+                       }
+
+                       return 行;
+               }
        }
 }
index 6283dfd..b18eeef 100644 (file)
@@ -53,7 +53,7 @@
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="v1\スコアTests.cs" />
-    <Compile Include="v2\スコアTests.cs" />
+    <Compile Include="VersionTests.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\SSTFormat\SSTFormat.csproj">
diff --git a/SSTFormatTests/VersionTests.cs b/SSTFormatTests/VersionTests.cs
new file mode 100644 (file)
index 0000000..f8cf4bc
--- /dev/null
@@ -0,0 +1,85 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using SSTFormat;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace SSTFormat.Tests
+{
+       [TestClass()]
+       public class VersionTests
+       {
+               private void ファイルに新規出力する( string tempName, string 出力文字列 )
+               {
+                       using( var sw = new StreamWriter( tempName, false, Encoding.UTF8 ) )
+                       {
+                               sw.WriteLine( 出力文字列 );
+                       }
+               }
+
+               [TestMethod()]
+               public void CreateVersionFromFileTest()
+               {
+                       string tempName = Path.GetTempFileName();
+                       try
+                       {
+                               // 正常系。
+
+                               #region " 正常な記述。"
+                               this.ファイルに新規出力する( tempName, @"SSTFVersion 1.2.3.4" );
+                               Assert.IsTrue( new Version( 1, 2, 3, 4 ) == Version.CreateVersionFromFile( tempName ) );
+                               #endregion
+                               #region " 省略時は 1.0.0.0 になる。"
+                               this.ファイルに新規出力する( tempName, @"# コメントやよー" );
+                               Assert.IsTrue( new Version( 1, 0, 0, 0 ) == Version.CreateVersionFromFile( tempName ) );
+                               #endregion
+                               #region " トークンとバージョン番号の間に空白がなくても大丈夫。"
+                               this.ファイルに新規出力する( tempName, @"SSTFVersion5.6.7.8" );
+                               Assert.IsTrue( new Version( 5, 6, 7, 8 ) == Version.CreateVersionFromFile( tempName ) );
+                               #endregion
+                               #region " Revision は省略可能。"
+                               this.ファイルに新規出力する( tempName, @"SSTFVersion 9.10.11" );
+                               Assert.IsTrue( new Version( 9, 10, 11 ) == Version.CreateVersionFromFile( tempName ) );
+                               #endregion
+                               #region " Build と Revision は省略可能。"
+                               this.ファイルに新規出力する( tempName, @"SSTFVersion 12.13" );
+                               Assert.IsTrue( new Version( 12, 13 ) == Version.CreateVersionFromFile( tempName ) );
+                               #endregion
+
+                               // 準正常系。
+
+                               #region " Major と Minor は省略不可。"
+                               this.ファイルに新規出力する( tempName, @"SSTFVersion 12" );
+                               try
+                               {
+                                       var ver = Version.CreateVersionFromFile( tempName );
+                               }
+                               catch( System.ArgumentException )
+                               {
+                                       // 成功。
+                               }
+                               this.ファイルに新規出力する( tempName, @"SSTFVersion " );
+                               try
+                               {
+                                       var ver = Version.CreateVersionFromFile( tempName );
+                               }
+                               catch( System.ArgumentException )
+                               {
+                                       // 成功。
+                               }
+                               #endregion
+                               #region " 2行目以降に指定しても無視されて、1.0.0.0 になる。"
+                               this.ファイルに新規出力する( tempName, @"# 1行目やよー\nSSTFVersion 1.2.3.4\n# 3行目やよー" );
+                               Assert.IsTrue( new Version( 1, 0, 0, 0 ) == Version.CreateVersionFromFile( tempName ) );
+                               #endregion
+                       }
+                       finally
+                       {
+                               File.Delete( tempName );
+                       }
+               }
+       }
+}
\ No newline at end of file
index 1e738bf..073e88b 100644 (file)
@@ -3,7 +3,6 @@ using SSTFormat;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
-using System.IO;
 using System.Linq;
 using SSTFormat.v1;
 
@@ -12,14 +11,6 @@ namespace SSTFormat.v1.Tests
        [TestClass()]
        public class スコアTests
        {
-               private void ファイルに新規出力する( string ファイル名, string 文字列 )
-               {
-                       using( var sw = new StreamWriter( new FileStream( ファイル名, FileMode.Create ) ) )
-                       {
-                               sw.WriteLine( 文字列 );
-                       }
-               }
-
                [TestMethod()]
                public void コマンドのパラメータ文字列部分を返すTest()
                {
@@ -157,58 +148,5 @@ namespace SSTFormat.v1.Tests
 
                        #endregion
                }
-
-               [TestMethod()]
-               public void 行を読み込むTest()
-               {
-                       string tempPath = Path.GetTempFileName();
-                       try
-                       {
-                               // 正常系。
-
-                               #region " 行の先頭に '#' がある場合、空文字列が得られる。"
-                               this.ファイルに新規出力する( tempPath, @"# これはコメントです。" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"", スコア.行を読み込む( reader ) );
-                               }
-                               #endregion
-                               #region " 行の途中に '#' がある場合、その直前までの文字列が得られる。"
-                               this.ファイルに新規出力する( tempPath, @"これは#コメントです。" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"これは", スコア.行を読み込む( reader ) );
-                               }
-                               #endregion
-                               #region " 行の末尾に '#' がある場合、その直前までの文字列が得られる。"
-                               this.ファイルに新規出力する( tempPath, @"これはコメントです。#" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"これはコメントです。", スコア.行を読み込む( reader ) );
-                               }
-                               #endregion
-                               #region " 行に複数の '#' がある場合、最初の '#' の直前までの文字列が得られる。"
-                               this.ファイルに新規出力する( tempPath, @"これ#はコメント#です。" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"これ", スコア.行を読み込む( reader ) );
-                               }
-                               this.ファイルに新規出力する( tempPath, @"#これ#はコメントです。" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"", スコア.行を読み込む( reader ) );
-                               }
-                               this.ファイルに新規出力する( tempPath, @"#これはコメントです。#" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"", スコア.行を読み込む( reader ) );
-                               }
-                               #endregion
-                       }
-                       finally
-                       {
-                               File.Delete( tempPath );
-                       }
-               }
        }
 }
\ No newline at end of file
diff --git a/SSTFormatTests/v2/スコアTests.cs b/SSTFormatTests/v2/スコアTests.cs
deleted file mode 100644 (file)
index 74fee28..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using SSTFormat.v2;
-
-namespace SSTFormat.v2.Tests
-{
-       [TestClass()]
-       public class スコアTests
-       {
-               private void ファイルに新規出力する( string ファイル名, string 文字列 )
-               {
-                       using( var sw = new StreamWriter( new FileStream( ファイル名, FileMode.Create ) ) )
-                       {
-                               sw.WriteLine( 文字列 );
-                       }
-               }
-
-               [TestMethod()]
-               public void 行を読み込むTest()
-               {
-                       string tempPath = Path.GetTempFileName();
-                       try
-                       {
-                               // 正常系。
-
-                               #region " 行の先頭に '#' がある場合、空文字列が得られる。"
-                               this.ファイルに新規出力する( tempPath, @"# これはコメントです。" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"", スコア.行を読み込む( reader ) );
-                               }
-                               #endregion
-                               #region " 行の途中に '#' がある場合、その直前までの文字列が得られる。"
-                               this.ファイルに新規出力する( tempPath, @"これは#コメントです。" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"これは", スコア.行を読み込む( reader ) );
-                               }
-                               #endregion
-                               #region " 行の末尾に '#' がある場合、その直前までの文字列が得られる。"
-                               this.ファイルに新規出力する( tempPath, @"これはコメントです。#" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"これはコメントです。", スコア.行を読み込む( reader ) );
-                               }
-                               #endregion
-                               #region " 行に複数の '#' がある場合、最初の '#' の直前までの文字列が得られる。"
-                               this.ファイルに新規出力する( tempPath, @"これ#はコメント#です。" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"これ", スコア.行を読み込む( reader ) );
-                               }
-                               this.ファイルに新規出力する( tempPath, @"#これ#はコメントです。" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"", スコア.行を読み込む( reader ) );
-                               }
-                               this.ファイルに新規出力する( tempPath, @"#これはコメントです。#" );
-                               using( var reader = new StreamReader( tempPath ) )
-                               {
-                                       Assert.AreEqual( @"", スコア.行を読み込む( reader ) );
-                               }
-                               #endregion
-                       }
-                       finally
-                       {
-                               File.Delete( tempPath );
-                       }
-               }
-       }
-}