コード例 #1
0
        public void WriteTest_UsingRingBuffer_Fail()
        {
            ClearFile();

            string[] data = new string[] { "string1", "string2", "string3", "string4", "string5", "string6" };
            BufferedFileWriter <string> testSubject = new BufferedFileWriter <string>(new RingBuffer <string>(4), testPath);

            foreach (var str in data)
            {
                testSubject.Write(str);
            }

            testSubject.Dispose();

            StreamReader  reader = new StreamReader(new FileStream(testPath, FileMode.Open));
            List <string> readen = new List <string>();

            while (!reader.EndOfStream)
            {
                readen.Add(reader.ReadLine());
            }
            reader.Close();

            bool isOk = readen.Count == data.Length;

            foreach (var str in readen)
            {
                isOk &= data.Contains(str);
                Debug.WriteLine(str);
            }

            Assert.IsFalse(isOk);
        }