示例#1
0
		/// <exception cref="System.IO.IOException"></exception>
		protected internal static void CheckFile(FilePath f, string checkData)
		{
			StreamReader r = new InputStreamReader(new FileInputStream(f), "ISO-8859-1");
			try
			{
				char[] data = new char[(int)f.Length()];
				if (f.Length() != r.Read(data))
				{
					throw new IOException("Internal error reading file data from " + f);
				}
				NUnit.Framework.Assert.AreEqual(checkData, new string(data));
			}
			finally
			{
				r.Close();
			}
		}
示例#2
0
 /// <exception cref="System.IO.IOException"></exception>
 private string ReadTestPatchFile(Encoding cs)
 {
     string patchFile = Sharpen.Extensions.GetTestName() + ".patch";
     InputStream @in = GetType().GetResourceAsStream(patchFile);
     if (@in == null)
     {
         NUnit.Framework.Assert.Fail("No " + patchFile + " test vector");
         return null;
     }
     // Never happens
     try
     {
         InputStreamReader r = new InputStreamReader(@in, cs);
         char[] tmp = new char[2048];
         StringBuilder s = new StringBuilder();
         int n;
         while ((n = r.Read(tmp)) > 0)
         {
             s.Append(tmp, 0, n);
         }
         return s.ToString();
     }
     finally
     {
         @in.Close();
     }
 }