document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. namespace UnitTests
  2. {
  3.     using System;
  4.     using System.Collections;
  5.     using System.Collections.Generic;
  6.     using System.Data;
  7.  
  8.     public class MockParameterCollection : IDataParameterCollection
  9.     {
  10.         public List<object> Items { get; private set; }
  11.  
  12.         private readonly Dictionary<string, object> paramValuesToReplace;
  13.  
  14.         public MockParameterCollection(Dictionary<string, object> paramValuesToReplace = null)
  15.         {
  16.             this.paramValuesToReplace = paramValuesToReplace;
  17.             this.SyncRoot = new object();
  18.             this.Items = new List<object>();
  19.         }
  20.  
  21.         public IEnumerator GetEnumerator()
  22.         {
  23.             return Items.GetEnumerator();
  24.         }
  25.  
  26.         public void CopyTo(Array array, int index)
  27.         {
  28.             throw new NotImplementedException();
  29.         }
  30.  
  31.         public int Count
  32.         {
  33.             get { return Items.Count; }
  34.         }
  35.  
  36.         public object SyncRoot { get; private set; }
  37.         public bool IsSynchronized { get; private set; }
  38.         public int Add(object value)
  39.         {
  40.             Items.Add(value);
  41.             var v = value as IDbDataParameter;
  42.             if (paramValuesToReplace != null && paramValuesToReplace.ContainsKey(v.ParameterName))
  43.             {
  44.                 v.Value = paramValuesToReplace[v.ParameterName];
  45.             }
  46.  
  47.             return Items.Count - 1;
  48.         }
  49.  
  50.         public bool Contains(object value)
  51.         {
  52.             throw new NotImplementedException();
  53.         }
  54.  
  55.         public void Clear()
  56.         {
  57.             Items.Clear();
  58.         }
  59.  
  60.         public int IndexOf(object value)
  61.         {
  62.             throw new NotImplementedException();
  63.         }
  64.  
  65.         public void Insert(int index, object value)
  66.         {
  67.             throw new NotImplementedException();
  68.         }
  69.  
  70.         public void Remove(object value)
  71.         {
  72.             throw new NotImplementedException();
  73.         }
  74.  
  75.         public void RemoveAt(int index)
  76.         {
  77.             throw new NotImplementedException();
  78.         }
  79.  
  80.         object IList.this[int index]
  81.         {
  82.             get { return this.Items[index]; }
  83.             set { throw new NotImplementedException(); }
  84.         }
  85.  
  86.         public bool IsReadOnly { get; private set; }
  87.         public bool IsFixedSize { get; private set; }
  88.         public bool Contains(string parameterName)
  89.         {
  90.             throw new NotImplementedException();
  91.         }
  92.  
  93.         public int IndexOf(string parameterName)
  94.         {
  95.             throw new NotImplementedException();
  96.         }
  97.  
  98.         public void RemoveAt(string parameterName)
  99.         {
  100.             throw new NotImplementedException();
  101.         }
  102.  
  103.         object IDataParameterCollection.this[string parameterName]
  104.         {
  105.             get { throw new NotImplementedException(); }
  106.             set { throw new NotImplementedException(); }
  107.         }
  108.     }
  109. }
');