/// <summary>
		/// Creates and returns a mocker for the given object type.
		/// </summary>
		/// <param name="type">The object type to mock. This can be either an interface, or a type derived from MarshalByRef.</param>
		/// <param name="name">The name uniquely identifying the instance.</param>
		public virtual ManualMocker Mock(Type type, string name) {
			try {
				ManualMocker mocker = new ManualMocker();
				MockingProxy proxy = new MockingProxy(type, mocker, name);
				mocker.Initialize(proxy);
				mockers.Add(mocker);
				return mocker;
			} catch (ArgumentException ex) {
				throw new MockException("Type to mock must be an interface or derive from MarshalByRef.", ex);
			}
		}
Exemple #2
0
 /// <summary>
 /// Creates and returns a mocker for the given object type.
 /// </summary>
 /// <param name="type">The object type to mock. This can be either an interface, or a type derived from MarshalByRef.</param>
 /// <param name="name">The name uniquely identifying the instance.</param>
 public virtual ManualMocker Mock(Type type, string name)
 {
     try {
         ManualMocker mocker = new ManualMocker();
         MockingProxy proxy  = new MockingProxy(type, mocker, name);
         mocker.Initialize(proxy);
         mockers.Add(mocker);
         return(mocker);
     } catch (ArgumentException ex) {
         throw new MockException("Type to mock must be an interface or derive from MarshalByRef.", ex);
     }
 }