Ejemplo n.º 1
0
		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");
		}
Ejemplo n.º 2
0
		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");
		}
Ejemplo n.º 3
0
		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");
		}
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
 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));
        }
Ejemplo n.º 8
0
 public CircularArrayEnumerator(CircularArray array, EnumeratorDirection direction)
 {
     this.array     = array;
     this.direction = direction;
 }
Ejemplo n.º 9
0
			public CircularArrayEnumerator(CircularArray array, EnumeratorDirection direction)
			{
				this.array = array;
				this.direction = direction;
			}
Ejemplo n.º 10
0
		public void SetUp()
		{
			arrayStringBuffer = new CircularArray(20);
		}