using System;
using System.Collections;
using System.Collections.Generic;
namespace Python.Test
{
public class MpLengthCollectionTest : ICollection
{
private readonly List items;
public MpLengthCollectionTest()
{
SyncRoot = new object();
items = new List
{
1,
2,
3
};
}
public int Count => items.Count;
public object SyncRoot { get; private set; }
public bool IsSynchronized => false;
public void CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
public IEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
}
public class MpLengthExplicitCollectionTest : ICollection
{
private readonly List items;
private readonly object syncRoot;
public MpLengthExplicitCollectionTest()
{
syncRoot = new object();
items = new List
{
9,
10
};
}
int ICollection.Count => items.Count;
object ICollection.SyncRoot => syncRoot;
bool ICollection.IsSynchronized => false;
void ICollection.CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
}
public class MpLengthGenericCollectionTest : ICollection
{
private readonly List items;
public MpLengthGenericCollectionTest() {
SyncRoot = new object();
items = new List();
}
public int Count => items.Count;
public object SyncRoot { get; private set; }
public bool IsSynchronized => false;
public bool IsReadOnly => false;
public void Add(T item)
{
items.Add(item);
}
public void Clear()
{
items.Clear();
}
public bool Contains(T item)
{
return items.Contains(item);
}
public void CopyTo(T[] array, int arrayIndex)
{
items.CopyTo(array, arrayIndex);
}
public IEnumerator GetEnumerator()
{
return ((IEnumerable)items).GetEnumerator();
}
public bool Remove(T item)
{
return items.Remove(item);
}
IEnumerator IEnumerable.GetEnumerator()
{
return items.GetEnumerator();
}
}
public class MpLengthExplicitGenericCollectionTest : ICollection
{
private readonly List items;
public MpLengthExplicitGenericCollectionTest()
{
items = new List();
}
int ICollection.Count => items.Count;
bool ICollection.IsReadOnly => false;
public void Add(T item)
{
items.Add(item);
}
void ICollection.Clear()
{
items.Clear();
}
bool ICollection.Contains(T item)
{
return items.Contains(item);
}
void ICollection.CopyTo(T[] array, int arrayIndex)
{
items.CopyTo(array, arrayIndex);
}
IEnumerator IEnumerable.GetEnumerator()
{
return items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable)items).GetEnumerator();
}
bool ICollection.Remove(T item)
{
return items.Remove(item);
}
}
}