Click here to Skip to main content
15,886,519 members
Articles / Web Development / ASP.NET

MbUnit : Generative Unit Test Framework

Rate me:
Please Sign up or sign in to vote.
4.70/5 (38 votes)
15 Apr 20046 min read 221.7K   496   120  
A new highly flexible unit test framework with new fixtures
using System;

namespace GUnit.Core.Collections
{
	/// <summary>
	/// A collection of elements of type RunPipe
	/// </summary>
	public class RunPipeCollection: System.Collections.CollectionBase
	{
		/// <summary>
		/// Initializes a new empty instance of the RunPipeCollection class.
		/// </summary>
		public RunPipeCollection()
		{
			// empty
		}

		/// <summary>
		/// Initializes a new instance of the RunPipeCollection class, containing elements
		/// copied from an array.
		/// </summary>
		/// <param name="items">
		/// The array whose elements are to be added to the new RunPipeCollection.
		/// </param>
		public RunPipeCollection(RunPipe[] items)
		{
			this.AddRange(items);
		}

		/// <summary>
		/// Initializes a new instance of the RunPipeCollection class, containing elements
		/// copied from another instance of RunPipeCollection
		/// </summary>
		/// <param name="items">
		/// The RunPipeCollection whose elements are to be added to the new RunPipeCollection.
		/// </param>
		public RunPipeCollection(RunPipeCollection items)
		{
			this.AddRange(items);
		}

		/// <summary>
		/// Adds the elements of an array to the end of this RunPipeCollection.
		/// </summary>
		/// <param name="items">
		/// The array whose elements are to be added to the end of this RunPipeCollection.
		/// </param>
		public virtual void AddRange(RunPipe[] items)
		{
			foreach (RunPipe item in items)
			{
				this.List.Add(item);
			}
		}

		/// <summary>
		/// Adds the elements of another RunPipeCollection to the end of this RunPipeCollection.
		/// </summary>
		/// <param name="items">
		/// The RunPipeCollection whose elements are to be added to the end of this RunPipeCollection.
		/// </param>
		public virtual void AddRange(RunPipeCollection items)
		{
			foreach (RunPipe item in items)
			{
				this.List.Add(item);
			}
		}

		/// <summary>
		/// Adds an instance of type RunPipe to the end of this RunPipeCollection.
		/// </summary>
		/// <param name="value">
		/// The RunPipe to be added to the end of this RunPipeCollection.
		/// </param>
		public virtual void Add(RunPipe value)
		{
			this.List.Add(value);
		}

		/// <summary>
		/// Determines whether a specfic RunPipe value is in this RunPipeCollection.
		/// </summary>
		/// <param name="value">
		/// The RunPipe value to locate in this RunPipeCollection.
		/// </param>
		/// <returns>
		/// true if value is found in this RunPipeCollection;
		/// false otherwise.
		/// </returns>
		public virtual bool Contains(RunPipe value)
		{
			return this.List.Contains(value);
		}

		/// <summary>
		/// Return the zero-based index of the first occurrence of a specific value
		/// in this RunPipeCollection
		/// </summary>
		/// <param name="value">
		/// The RunPipe value to locate in the RunPipeCollection.
		/// </param>
		/// <returns>
		/// The zero-based index of the first occurrence of the _ELEMENT value if found;
		/// -1 otherwise.
		/// </returns>
		public virtual int IndexOf(RunPipe value)
		{
			return this.List.IndexOf(value);
		}

		/// <summary>
		/// Inserts an element into the RunPipeCollection at the specified index
		/// </summary>
		/// <param name="index">
		/// The index at which the RunPipe is to be inserted.
		/// </param>
		/// <param name="value">
		/// The RunPipe to insert.
		/// </param>
		public virtual void Insert(int index, RunPipe value)
		{
			this.List.Insert(index, value);
		}

		/// <summary>
		/// Gets or sets the RunPipe at the given index in this RunPipeCollection.
		/// </summary>
		public virtual RunPipe this[int index]
		{
			get
			{
				return (RunPipe) this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		/// <summary>
		/// Removes the first occurrence of a specific RunPipe from this RunPipeCollection.
		/// </summary>
		/// <param name="value">
		/// The RunPipe value to remove from this RunPipeCollection.
		/// </param>
		public virtual void Remove(RunPipe value)
		{
			this.List.Remove(value);
		}

		/// <summary>
		/// Type-specific enumeration class, used by RunPipeCollection.GetEnumerator.
		/// </summary>
		public class Enumerator: System.Collections.IEnumerator
		{
			private System.Collections.IEnumerator wrapped;

			public Enumerator(RunPipeCollection collection)
			{
				this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
			}

			public RunPipe Current
			{
				get
				{
					return (RunPipe) (this.wrapped.Current);
				}
			}

			object System.Collections.IEnumerator.Current
			{
				get
				{
					return (RunPipe) (this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
		}

		/// <summary>
		/// Returns an enumerator that can iterate through the elements of this RunPipeCollection.
		/// </summary>
		/// <returns>
		/// An object that implements System.Collections.IEnumerator.
		/// </returns>        
		public new virtual RunPipeCollection.Enumerator GetEnumerator()
		{
			return new RunPipeCollection.Enumerator(this);
		}
	}

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Engineer
United States United States
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).

Comments and Discussions