namespace UnitTests
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
public class MockParameterCollection : IDataParameterCollection
{
public List<object> Items { get; private set; }
private readonly Dictionary<string, object> paramValuesToReplace;
public MockParameterCollection(Dictionary<string, object> paramValuesToReplace = null)
{
this.paramValuesToReplace = paramValuesToReplace;
this.SyncRoot = new object();
this.Items = new List<object>();
}
public IEnumerator GetEnumerator()
{
return Items.GetEnumerator();
}
public void CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
public int Count
{
get { return Items.Count; }
}
public object SyncRoot { get; private set; }
public bool IsSynchronized { get; private set; }
public int Add(object value)
{
Items.Add(value);
var v = value as IDbDataParameter;
if (paramValuesToReplace != null && paramValuesToReplace.ContainsKey(v.ParameterName))
{
v.Value = paramValuesToReplace[v.ParameterName];
}
return Items.Count - 1;
}
public bool Contains(object value)
{
throw new NotImplementedException();
}
public void Clear()
{
Items.Clear();
}
public int IndexOf(object value)
{
throw new NotImplementedException();
}
public void Insert(int index, object value)
{
throw new NotImplementedException();
}
public void Remove(object value)
{
throw new NotImplementedException();
}
public void RemoveAt(int index)
{
throw new NotImplementedException();
}
object IList.this[int index]
{
get { return this.Items[index]; }
set { throw new NotImplementedException(); }
}
public bool IsReadOnly { get; private set; }
public bool IsFixedSize { get; private set; }
public bool Contains(string parameterName)
{
throw new NotImplementedException();
}
public int IndexOf(string parameterName)
{
throw new NotImplementedException();
}
public void RemoveAt(string parameterName)
{
throw new NotImplementedException();
}
object IDataParameterCollection.this[string parameterName]
{
get { throw new NotImplementedException(); }
set { throw new NotImplementedException(); }
}
}
}