public void ReadFewerLinesThanCapacity()
		{
			arrayStringBuffer = new CircularArray(30);
			AddLines(20);
			Assert.AreEqual(CircularArrayTestResources.BackwardThirty, arrayStringBuffer.ToString(EnumeratorDirection.Backward), "Wrong lines returned when underfilling array");
			Assert.AreEqual(CircularArrayTestResources.ForwardThirty, arrayStringBuffer.ToString(EnumeratorDirection.Forward), "Wrong lines returned when underfilling array");
		}
		public void ReadMoreLinesThanCapacity()
		{
			arrayStringBuffer = new CircularArray(5);
			AddLines(20);
			Assert.AreEqual(CircularArrayTestResources.ForwardLastFive, arrayStringBuffer.ToString(EnumeratorDirection.Forward), "Wrong lines returned when overfilling array");
			Assert.AreEqual(CircularArrayTestResources.BackwardLastFive, arrayStringBuffer.ToString(EnumeratorDirection.Backward), "Wrong lines returned when overfilling array");
		}
		public void ReadFiveLines()
		{
			arrayStringBuffer = new CircularArray(5);
			AddLines(5);
			Assert.AreEqual(CircularArrayTestResources.ForwardFive, arrayStringBuffer.ToString(EnumeratorDirection.Forward), "Wrong lines returned when filling array");
			Assert.AreEqual(CircularArrayTestResources.BackwardFive, arrayStringBuffer.ToString(EnumeratorDirection.Backward), "Wrong lines returned");
		}
 public string Read(EnumeratorDirection direction)
 {
     CircularArray buffer = new CircularArray(maxLines);
     using (Stream stream = OpenFile())
     {
         using (StreamReader reader = new StreamReader(stream))
         {
             string line;
             while ((line = reader.ReadLine()) != null)
             {
                 buffer.Add(line);
             }
         }
     }
     return buffer.ToString(direction);
 }
        public string Read(EnumeratorDirection direction)
        {
            CircularArray buffer = new CircularArray(maxLines);

            using (Stream stream = OpenFile())
            {
                using (StreamReader reader = new StreamReader(stream))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        buffer.Add(line);
                    }
                }
            }
            return(buffer.ToString(direction));
        }
 private string Read(EnumeratorDirection direction, string match)
 {
     CircularArray buffer = new CircularArray(maxLines);
     using (Stream stream = OpenFile())
     {
         using (StreamReader reader = new StreamReader(stream,System.Text.Encoding.Default))
         {
             string line;
             while ((line = reader.ReadLine()) != null)
             {
                 if (match == null || line.IndexOf(match) >= 0)
                     buffer.Add(line);
                 // TODO: Messages can contain embedded newlines (e.g., exception reports).
                 // TODO: This code should be changed to capture those "follow on" lines as well.
             }
         }
     }
     return buffer.ToString(direction);
 }
        private string Read(EnumeratorDirection direction, string match)
        {
            CircularArray buffer = new CircularArray(maxLines);

            using (Stream stream = OpenFile())
            {
                using (StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        if (match == null || line.IndexOf(match) >= 0)
                        {
                            buffer.Add(line);
                        }
                        // TODO: Messages can contain embedded newlines (e.g., exception reports).
                        // TODO: This code should be changed to capture those "follow on" lines as well.
                    }
                }
            }
            return(buffer.ToString(direction));
        }
 public CircularArrayEnumerator(CircularArray array, EnumeratorDirection direction)
 {
     this.array     = array;
     this.direction = direction;
 }
			public CircularArrayEnumerator(CircularArray array, EnumeratorDirection direction)
			{
				this.array = array;
				this.direction = direction;
			}
		public void SetUp()
		{
			arrayStringBuffer = new CircularArray(20);
		}