Parent

Included Modules

Files

Caricature::Expectation

Adds event support to the expectation this is only applicable to clr isolations and not to ruby isolations


A description of an expectation. An expectation has the power to call the proxy method or completely ignore it

Public Class Methods

new(options={}) click to toggle source

Initializes a new instance of an expectation

     # File lib/caricature/expectation.rb, line 164
164:     def initialize(options={})
165:       collected[:any_args] = true
166:       collected.merge!(options)
167:     end

Public Instance Methods

args() click to toggle source

the arguments that this expectation needs to be constrained by

     # File lib/caricature/expectation.rb, line 159
159:     def args
160:       collected[:args]
161:     end
block() click to toggle source

the block that will be used

     # File lib/caricature/expectation.rb, line 144
144:     def block
145:       collected[:block]
146:     end
block=(val) click to toggle source

sets the block callback

     # File lib/caricature/expectation.rb, line 149
149:     def block=(val)
150:       collected[:block] = val
151:     end
block_args() click to toggle source

contains the arguments that will be passed on to the block

     # File lib/caricature/expectation.rb, line 134
134:     def block_args
135:       collected[:block_args]
136:     end
block_callback() click to toggle source

The block that will be used as value provider for the block in the method

     # File lib/caricature/expectation.rb, line 139
139:     def block_callback
140:       collected[:block_callback]
141:     end
call_super?() click to toggle source

indicates whether super needs to be called somewhere

     # File lib/caricature/expectation.rb, line 185
185:     def call_super?
186:       !collected[:super].nil?
187:     end
callback() click to toggle source

contains the callback if one is given

     # File lib/caricature/expectation.rb, line 123
123:     def callback
124:       collected[:callback]
125:     end
error_args() click to toggle source

the error_args that this expectation will raise an error with

     # File lib/caricature/expectation.rb, line 108
108:     def error_args
109:       collected[:error_args]
110:     end
event_args() click to toggle source

the arguments that will be used for the event

    # File lib/caricature/clr/expectation.rb, line 37
37:     def event_args
38:       evt_ags = collected[:event_args]
39:       evt_ags.nil? or evt_ags.empty? ? [nil, System::EventArgs.empty] : evt_ags
40:     end
event_handler() click to toggle source

the block that will be used# the block that will be used

    # File lib/caricature/clr/expectation.rb, line 43
43:     def event_handler
44:       collected[:event_handler] || lambda { |s,e| }
45:     end
event_name() click to toggle source

the block that will be used

    # File lib/caricature/clr/expectation.rb, line 32
32:     def event_name
33:       collected[:event_name]
34:     end
event_recorder(&b) click to toggle source
    # File lib/caricature/clr/expectation.rb, line 72
72:     def event_recorder(&b)
73:       @event_recorder = b
74:     end
events() click to toggle source

the events attached to the context

    # File lib/caricature/clr/expectation.rb, line 48
48:     def events
49:       collected[:events] ||= {}
50:     end
events=(evts) click to toggle source

Set the registered events for this expectation

    # File lib/caricature/clr/expectation.rb, line 53
53:     def events=(evts)
54:       collected[:events]=evts
55:     end
execute(*margs,&b) click to toggle source

executes this expectation with its configuration

     # File lib/caricature/expectation.rb, line 205
205:     def execute(*margs,&b)
206:       ags = any_args? ? :any : (margs.empty? ? collected[:args] : margs)
207:       do_raise_error
208:       do_callback(ags)
209:       do_block_callback(&b)
210:       do_event_raise if respond_to?(:events)
211: 
212:       return collected[:return_callback].call(*margs) if has_return_callback?
213:       return return_value if has_return_value? 
214:       nil
215:     end
has_block_callback?() click to toggle source

indicates whether this expectation has a block as value provider for the method call block

     # File lib/caricature/expectation.rb, line 195
195:     def has_block_callback?
196:       !collected[:block_callback].nil?
197:     end
has_callback?() click to toggle source

indicates whether this expecation has a callback it needs to execute

     # File lib/caricature/expectation.rb, line 190
190:     def has_callback? 
191:       !collected[:callback].nil?
192:     end
has_error_args?() click to toggle source

indicates whether this expecation will raise an event.

     # File lib/caricature/expectation.rb, line 170
170:     def has_error_args?
171:       !collected[:error_args].nil?
172:     end
has_event_handler?() click to toggle source

indicates whether this expectation has an event handler to be called

    # File lib/caricature/clr/expectation.rb, line 63
63:     def has_event_handler?
64:       !!collected[:event_handler]
65:     end
has_return_callback?() click to toggle source

a flag to indicate it has a return value callback

     # File lib/caricature/expectation.rb, line 200
200:     def has_return_callback?
201:       !collected[:return_callback].nil?
202:     end
has_return_value?() click to toggle source

indicates whether this expectation will return a value.

     # File lib/caricature/expectation.rb, line 175
175:     def has_return_value?
176:       !collected[:return_value].nil?
177:     end
method_name() click to toggle source

gets the method_name to which this expectation needs to listen to

     # File lib/caricature/expectation.rb, line 154
154:     def method_name 
155:       collected[:method_name]
156:     end
raises_event?() click to toggle source

indicates whether this expectation has an event that needs to be raised

    # File lib/caricature/clr/expectation.rb, line 58
58:     def raises_event?
59:       !!collected[:event_name]
60:     end
raises_registered?() click to toggle source

indicates whether to raise the registered event handlers

    # File lib/caricature/clr/expectation.rb, line 68
68:     def raises_registered?
69:       !!collected[:raise_subscriptions]
70:     end
return_callback() click to toggle source

contains the callback that is used to return the value when this expectation is executed

     # File lib/caricature/expectation.rb, line 129
129:     def return_callback
130:       collected[:return_callback]
131:     end
return_value() click to toggle source

the value that this expecation will return when executed

     # File lib/caricature/expectation.rb, line 113
113:     def return_value
114:       collected[:return_value]
115:     end
super() click to toggle source

indicator for the mode to call the super :before, :after and nil

     # File lib/caricature/expectation.rb, line 118
118:     def super 
119:       collected[:super]
120:     end
super_before?() click to toggle source

call the super before the expectation

     # File lib/caricature/expectation.rb, line 180
180:     def super_before?
181:       collected[:super] == :before
182:     end

Private Instance Methods

call_handler(evt, *ags) click to toggle source
    # File lib/caricature/clr/expectation.rb, line 95
95:     def call_handler(evt, *ags)
96:       evt.respond_to?(:call) ? evt.call(*ags) : evt.get_invocation_list.each{|ev| ev.invoke(*ags) }
97:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.