1 // ****************************************************************
2 // Copyright 2007, Charlie Poole
3 // This is free software licensed under the NUnit license. You may
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
5 // ****************************************************************
12 /// Summary description for IMock.
14 public interface IMock
: IVerify
, ICallHandler
17 /// The name of this mock - used in messages
22 /// True if unexpected calls should cause an error, false to ignore them
24 bool Strict { get; set; }
27 /// Set up to expect a call to a method with a set of arguments
29 /// <param name="methodName">The name of the method</param>
30 /// <param name="args">Arguments for this call</param>
31 void Expect( string methodName
, params object[] args
);
33 void Expect( string MethodName
);
36 /// Set up expectation that the named method will not be called
38 /// <param name="methodName">The name of the method</param>
39 void ExpectNoCall( string methodName
);
42 /// Set up to expect a call to a method with a set of arguments.
43 /// The specified value will be returned.
45 /// <param name="methodName">The name of the method</param>
46 /// <param name="returnVal">The value to be returned</param>
47 /// <param name="args">Arguments for this call</param>
48 void ExpectAndReturn( string methodName
, object returnVal
, params object[] args
);
51 /// Set up to expect a call to a method with a set of arguments.
52 /// The specified exception will be thrown.
54 /// <param name="methodname">The name of the method</param>
55 /// <param name="exception">The exception to throw</param>
56 /// <param name="args">Arguments for this call</param>
57 void ExpectAndThrow( string methodname
, Exception exception
, params object[] args
);
60 /// Set value to return for a method or property called with any arguments
62 /// <param name="methodName">The name of the method</param>
63 /// <param name="returnVal">The value to be returned</param>
64 void SetReturnValue( string methodName
, object returnVal
);