PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/NUnit/mocks/IMock.cs

#
C# | 66 lines | 15 code | 9 blank | 42 comment | 0 complexity | 9ba496e1c9ca046ac8ef744273bc4744 MD5 | raw file
 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
 5// ****************************************************************
 6
 7using System;
 8
 9namespace NUnit.Mocks
10{
11	/// <summary>
12	/// Summary description for IMock.
13	/// </summary>
14	public interface IMock : IVerify, ICallHandler
15	{
16		/// <summary>
17		/// The name of this mock - used in messages
18		/// </summary>
19		string Name { get; }
20	
21		/// <summary>
22		/// True if unexpected calls should cause an error, false to ignore them
23		/// </summary>
24		bool Strict { get; set; }
25
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 );
32
33		void Expect( string MethodName );
34
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 );
40
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 );
49
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 );
58
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 );
65	}
66}