2010-04-14 Jb Evain <jbevain@novell.com>
[mcs.git] / nunit24 / NUnitMocks / mocks / IMock.cs
blob43d1e09c3490243d0b188d86892f75b271bd468a
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 // ****************************************************************
7 using System;
9 namespace NUnit.Mocks
11 /// <summary>
12 /// Summary description for IMock.
13 /// </summary>
14 public interface IMock : IVerify, ICallHandler
16 /// <summary>
17 /// The name of this mock - used in messages
18 /// </summary>
19 string Name { get; }
21 /// <summary>
22 /// True if unexpected calls should cause an error, false to ignore them
23 /// </summary>
24 bool Strict { get; set; }
26 /// <summary>
27 /// Set up to expect a call to a method with a set of arguments
28 /// </summary>
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 );
35 /// <summary>
36 /// Set up expectation that the named method will not be called
37 /// </summary>
38 /// <param name="methodName">The name of the method</param>
39 void ExpectNoCall( string methodName );
41 /// <summary>
42 /// Set up to expect a call to a method with a set of arguments.
43 /// The specified value will be returned.
44 /// </summary>
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 );
50 /// <summary>
51 /// Set up to expect a call to a method with a set of arguments.
52 /// The specified exception will be thrown.
53 /// </summary>
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 );
59 /// <summary>
60 /// Set value to return for a method or property called with any arguments
61 /// </summary>
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 );