 
     
 
+# TODO: add description
 mock = (fn) ->
   mocks = ( new Mock() for i in [1..5] )
   fn.apply(undefined, mocks)
+  # TODO: wrap in try/catch: we want to capture all errors for all mocks.
   mock.check() for mock in mocks
 
 




class Mock

  constructor: ->
    @method_calls = []
    @current_signature = undefined
    @state = undefined
  
  expects: (method_name) ->
    @_check_expects_usage(method_name)
    @current_signature = new MethodSignature(method_name)

    @_set_state("args")
    @
    
  # TODO: add description
  returns: (value) ->
    @_check_returns_usage(value)
    @current_signature.returns = value
    @_set_state("returns")
    @
    
  # TODO: add description
  check: ->
    @_check_for_uncalled_signatures()
    @_set_state("check")
    @
    
  # private
  
  # TODO: re-order methods below
  
  _find_signature: (method_name, args...) ->
    for signature in @method_calls when signature.matches(method_name, args...)
