File: CollectionAdapter.cs

package info (click to toggle)
nunit 2.6.3+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,864 kB
  • ctags: 13,837
  • sloc: cs: 85,253; xml: 16,799; cpp: 512; sh: 198; makefile: 45; ansic: 8
file content (63 lines) | stat: -rw-r--r-- 1,227 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// ****************************************************************
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org.
// ****************************************************************

using System;
using System.Collections;

namespace NUnit.Framework.Tests
{
	/// <summary>
	/// ICollectionAdapter is used in testing to wrap an array or
	/// ArrayList, ensuring that only methods of the ICollection
	/// interface are accessible.
	/// </summary>
	class ICollectionAdapter : ICollection
	{
		private readonly ICollection inner;

		public ICollectionAdapter(ICollection inner)
		{
			this.inner = inner;
		}

		public ICollectionAdapter(params object[] inner)
		{
			this.inner = inner;
		}

		#region ICollection Members

		public void CopyTo(Array array, int index)
		{
			inner.CopyTo(array, index);
		}

		public int Count
		{
			get { return inner.Count; }
		}

		public bool IsSynchronized
		{
			get { return  inner.IsSynchronized; }
		}

		public object SyncRoot
		{
			get { return inner.SyncRoot; }
		}

		#endregion

		#region IEnumerable Members

		public IEnumerator GetEnumerator()
		{
			return inner.GetEnumerator();
		}

		#endregion
	}
}