PageRenderTime 46ms CodeModel.GetById 19ms 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
Possible License(s): GPL-2.0
  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. using System;
  7. namespace NUnit.Mocks
  8. {
  9. /// <summary>
  10. /// Summary description for IMock.
  11. /// </summary>
  12. public interface IMock : IVerify, ICallHandler
  13. {
  14. /// <summary>
  15. /// The name of this mock - used in messages
  16. /// </summary>
  17. string Name { get; }
  18. /// <summary>
  19. /// True if unexpected calls should cause an error, false to ignore them
  20. /// </summary>
  21. bool Strict { get; set; }
  22. /// <summary>
  23. /// Set up to expect a call to a method with a set of arguments
  24. /// </summary>
  25. /// <param name="methodName">The name of the method</param>
  26. /// <param name="args">Arguments for this call</param>
  27. void Expect( string methodName, params object[] args );
  28. void Expect( string MethodName );
  29. /// <summary>
  30. /// Set up expectation that the named method will not be called
  31. /// </summary>
  32. /// <param name="methodName">The name of the method</param>
  33. void ExpectNoCall( string methodName );
  34. /// <summary>
  35. /// Set up to expect a call to a method with a set of arguments.
  36. /// The specified value will be returned.
  37. /// </summary>
  38. /// <param name="methodName">The name of the method</param>
  39. /// <param name="returnVal">The value to be returned</param>
  40. /// <param name="args">Arguments for this call</param>
  41. void ExpectAndReturn( string methodName, object returnVal, params object[] args );
  42. /// <summary>
  43. /// Set up to expect a call to a method with a set of arguments.
  44. /// The specified exception will be thrown.
  45. /// </summary>
  46. /// <param name="methodname">The name of the method</param>
  47. /// <param name="exception">The exception to throw</param>
  48. /// <param name="args">Arguments for this call</param>
  49. void ExpectAndThrow( string methodname, Exception exception, params object[] args );
  50. /// <summary>
  51. /// Set value to return for a method or property called with any arguments
  52. /// </summary>
  53. /// <param name="methodName">The name of the method</param>
  54. /// <param name="returnVal">The value to be returned</param>
  55. void SetReturnValue( string methodName, object returnVal );
  56. }
  57. }