caricature 0.3.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/.gitignore +4 -0
  2. data/Rakefile +100 -0
  3. data/VERSION +1 -0
  4. data/caricature.gemspec +177 -0
  5. data/doc/Array.html +251 -0
  6. data/doc/Caricature/ArgumentRecording.html +366 -0
  7. data/doc/Caricature/ClrClassDescriptor.html +303 -0
  8. data/doc/Caricature/ClrClassMessenger.html +263 -0
  9. data/doc/Caricature/ClrInterfaceDescriptor.html +295 -0
  10. data/doc/Caricature/ClrInterfaceIsolator.html +365 -0
  11. data/doc/Caricature/ClrInterfaceMessenger.html +260 -0
  12. data/doc/Caricature/ClrIsolator.html +424 -0
  13. data/doc/Caricature/Expectation.html +549 -0
  14. data/doc/Caricature/ExpectationBuilder.html +308 -0
  15. data/doc/Caricature/ExpectationSyntax.html +438 -0
  16. data/doc/Caricature/Expectations.html +344 -0
  17. data/doc/Caricature/Interception/ClassMethods.html +246 -0
  18. data/doc/Caricature/Interception.html +416 -0
  19. data/doc/Caricature/Isolation.html +578 -0
  20. data/doc/Caricature/Isolator.html +519 -0
  21. data/doc/Caricature/MemberDescriptor.html +335 -0
  22. data/doc/Caricature/Messenger.html +335 -0
  23. data/doc/Caricature/MethodCallRecorder.html +440 -0
  24. data/doc/Caricature/MethodCallRecording.html +493 -0
  25. data/doc/Caricature/RubyIsolator.html +416 -0
  26. data/doc/Caricature/RubyMessenger.html +260 -0
  27. data/doc/Caricature/RubyObjectDescriptor.html +289 -0
  28. data/doc/Caricature/TypeDescriptor.html +378 -0
  29. data/doc/Caricature/Verification.html +443 -0
  30. data/doc/Caricature.html +358 -0
  31. data/doc/Class.html +287 -0
  32. data/doc/Hash.html +255 -0
  33. data/doc/Module.html +287 -0
  34. data/doc/Object.html +322 -0
  35. data/doc/README_markdown.html +241 -0
  36. data/doc/String.html +289 -0
  37. data/doc/System/String.html +289 -0
  38. data/doc/System/Type.html +289 -0
  39. data/doc/System.html +207 -0
  40. data/doc/created.rid +1 -0
  41. data/doc/images/brick.png +0 -0
  42. data/doc/images/brick_link.png +0 -0
  43. data/doc/images/bug.png +0 -0
  44. data/doc/images/bullet_black.png +0 -0
  45. data/doc/images/bullet_toggle_minus.png +0 -0
  46. data/doc/images/bullet_toggle_plus.png +0 -0
  47. data/doc/images/date.png +0 -0
  48. data/doc/images/find.png +0 -0
  49. data/doc/images/loadingAnimation.gif +0 -0
  50. data/doc/images/macFFBgHack.png +0 -0
  51. data/doc/images/package.png +0 -0
  52. data/doc/images/page_green.png +0 -0
  53. data/doc/images/page_white_text.png +0 -0
  54. data/doc/images/page_white_width.png +0 -0
  55. data/doc/images/plugin.png +0 -0
  56. data/doc/images/ruby.png +0 -0
  57. data/doc/images/tag_green.png +0 -0
  58. data/doc/images/wrench.png +0 -0
  59. data/doc/images/wrench_orange.png +0 -0
  60. data/doc/images/zoom.png +0 -0
  61. data/doc/index.html +312 -0
  62. data/doc/js/darkfish.js +116 -0
  63. data/doc/js/jquery.js +32 -0
  64. data/doc/js/quicksearch.js +114 -0
  65. data/doc/js/thickbox-compressed.js +10 -0
  66. data/doc/lib/caricature/clr/descriptor_rb.html +52 -0
  67. data/doc/lib/caricature/clr/isolation_rb.html +52 -0
  68. data/doc/lib/caricature/clr/isolator_rb.html +52 -0
  69. data/doc/lib/caricature/clr/messenger_rb.html +52 -0
  70. data/doc/lib/caricature/clr_rb.html +52 -0
  71. data/doc/lib/caricature/descriptor_rb.html +52 -0
  72. data/doc/lib/caricature/expectation_rb.html +52 -0
  73. data/doc/lib/caricature/isolation_rb.html +52 -0
  74. data/doc/lib/caricature/isolator_rb.html +52 -0
  75. data/doc/lib/caricature/messaging_rb.html +52 -0
  76. data/doc/lib/caricature/method_call_recorder_rb.html +52 -0
  77. data/doc/lib/caricature/verification_rb.html +52 -0
  78. data/doc/lib/caricature_rb.html +52 -0
  79. data/doc/lib/core_ext/array_rb.html +52 -0
  80. data/doc/lib/core_ext/class_rb.html +52 -0
  81. data/doc/lib/core_ext/core_ext_rb.html +52 -0
  82. data/doc/lib/core_ext/hash_rb.html +52 -0
  83. data/doc/lib/core_ext/module_rb.html +52 -0
  84. data/doc/lib/core_ext/object_rb.html +52 -0
  85. data/doc/lib/core_ext/string_rb.html +52 -0
  86. data/doc/lib/core_ext/system/string_rb.html +52 -0
  87. data/doc/lib/core_ext/system/type_rb.html +52 -0
  88. data/doc/rdoc.css +696 -0
  89. data/irb_init.rb +9 -0
  90. data/lib/bin/Workarounds.dll +0 -0
  91. data/lib/bin/Workarounds.pdb +0 -0
  92. data/lib/caricature/clr/descriptor.rb +55 -0
  93. data/lib/caricature/clr/isolation.rb +33 -0
  94. data/lib/caricature/clr/isolator.rb +112 -0
  95. data/lib/caricature/clr/messenger.rb +46 -0
  96. data/lib/caricature/clr.rb +6 -0
  97. data/lib/caricature/descriptor.rb +74 -0
  98. data/lib/caricature/expectation.rb +159 -0
  99. data/lib/caricature/isolation.rb +146 -0
  100. data/lib/caricature/isolator.rb +287 -0
  101. data/lib/caricature/messenger.rb +57 -0
  102. data/lib/caricature/method_call_recorder.rb +130 -0
  103. data/lib/caricature/verification.rb +43 -0
  104. data/lib/caricature.rb +11 -0
  105. data/lib/core_ext/array.rb +10 -0
  106. data/lib/core_ext/class.rb +15 -0
  107. data/lib/core_ext/core_ext.rb +8 -0
  108. data/lib/core_ext/hash.rb +13 -0
  109. data/lib/core_ext/module.rb +15 -0
  110. data/lib/core_ext/object.rb +19 -0
  111. data/lib/core_ext/string.rb +17 -0
  112. data/lib/core_ext/system/string.rb +21 -0
  113. data/lib/core_ext/system/type.rb +21 -0
  114. data/pkg/.gitignore +0 -0
  115. data/pkg/caricature-0.1.0.gem +0 -0
  116. data/spec/bacon_helper.rb +49 -3
  117. data/spec/bin/.gitignore +0 -0
  118. data/spec/core_ext_spec.rb +9 -0
  119. data/spec/descriptor_spec.rb +142 -0
  120. data/spec/expectation_spec.rb +11 -7
  121. data/spec/integration_spec.rb +94 -2
  122. data/spec/isolation_spec.rb +0 -42
  123. data/spec/isolator_spec.rb +72 -66
  124. data/spec/messaging_spec.rb +172 -0
  125. data/spec/method_call_spec.rb +21 -21
  126. data/spec/models/ClrModels.cs +185 -0
  127. data/spec/verification_spec.rb +1 -1
  128. data/workarounds/ReflectionHelper.cs +30 -0
  129. metadata +133 -2
@@ -0,0 +1,172 @@
1
+ require File.dirname(__FILE__) + "/bacon_helper"
2
+
3
+ class EmptyExpectations
4
+ def find(method_name, *args, &b)
5
+ nil
6
+ end
7
+ end
8
+
9
+ class ReturnValueExpecation
10
+
11
+ def initialize
12
+ @super_before_called = false
13
+ @call_super_called = false
14
+ @called_super_after = false
15
+ end
16
+
17
+ def super_before?
18
+ @super_before_called = true
19
+ false
20
+ end
21
+
22
+ def call_super?
23
+ @call_super_called = true
24
+ false
25
+ end
26
+
27
+ def have_called_super_before?
28
+ @super_before_called
29
+ end
30
+
31
+ def have_called_call_super?
32
+ @super_before_called && @called_super_after
33
+ end
34
+
35
+ def execute(*args)
36
+ @called_super_after = !@call_super_called
37
+ 5
38
+ end
39
+ end
40
+
41
+ class ReturnValueExpectations
42
+ def expectation
43
+ @expectation ||= ReturnValueExpecation.new
44
+ @expectation
45
+ end
46
+ def find(method_name, *args, &b)
47
+ return expectation if method_name == :a_message
48
+ nil
49
+ end
50
+ end
51
+
52
+ describe "Caricature::Messenger strategies" do
53
+
54
+ describe "Caricature::RubyMessenger" do
55
+
56
+ it "should return nil for any method name not in the expectation collection" do
57
+ messenger = Caricature::RubyMessenger.new EmptyExpectations.new
58
+ messenger.deliver(:a_message, nil).should.be.nil
59
+ end
60
+
61
+ describe "when an expectation with a return value has been defined" do
62
+
63
+ before do
64
+ @messenger = Caricature::RubyMessenger.new ReturnValueExpectations.new
65
+ end
66
+
67
+ it "should return the a value when specified by the expecation" do
68
+ @messenger.deliver(:a_message, nil).should.not.be.nil
69
+ end
70
+
71
+ it "should return the value specified by the expecation" do
72
+ @messenger.deliver(:a_message, nil).should.equal 5
73
+ end
74
+
75
+ it "should call super_before before executing the expectation" do
76
+ @messenger.deliver(:a_message, nil)
77
+ @messenger.expectations.expectation.should.have_called_super_before
78
+ end
79
+
80
+ it "should call call_super? after executing the expectation" do
81
+ @messenger.deliver(:a_message, nil)
82
+ @messenger.expectations.expectation.should.have_called_call_super
83
+ end
84
+
85
+ end
86
+
87
+
88
+
89
+
90
+ end
91
+
92
+ describe "Caricature::ClrClassMessenger" do
93
+
94
+ it "should return nil for any method name not in the expectation collection" do
95
+ messenger = Caricature::ClrClassMessenger.new EmptyExpectations.new
96
+ messenger.deliver(:a_message, nil).should.be.nil
97
+ end
98
+
99
+ it "should return the default value for a value type return type" do
100
+ messenger = Caricature::ClrClassMessenger.new EmptyExpectations.new
101
+ messenger.deliver(:a_message, System::Int32.to_clr_type).should.equal 0
102
+ end
103
+
104
+ describe "when an expectation with a return value has been defined" do
105
+
106
+ before do
107
+ @messenger = Caricature::ClrClassMessenger.new ReturnValueExpectations.new
108
+ end
109
+
110
+ it "should return the a value when specified by the expecation" do
111
+ @messenger.deliver(:a_message, nil).should.not.be.nil
112
+ end
113
+
114
+ it "should return the value specified by the expecation" do
115
+ @messenger.deliver(:a_message, nil).should.equal 5
116
+ end
117
+
118
+ it "should call super_before before executing the expectation" do
119
+ @messenger.deliver(:a_message, nil)
120
+ @messenger.expectations.expectation.should.have_called_super_before
121
+ end
122
+
123
+ it "should call call_super? after executing the expectation" do
124
+ @messenger.deliver(:a_message, nil)
125
+ @messenger.expectations.expectation.should.have_called_call_super
126
+ end
127
+
128
+ end
129
+
130
+ end
131
+
132
+ describe "Caricature::ClrInterfaceMessenger" do
133
+
134
+ it "should return nil for any method name not in the expectation collection" do
135
+ messenger = Caricature::ClrInterfaceMessenger.new EmptyExpectations.new
136
+ messenger.deliver(:a_message, nil).should.be.nil
137
+ end
138
+
139
+ it "should return the default value for a value type return type" do
140
+ messenger = Caricature::ClrClassMessenger.new EmptyExpectations.new
141
+ messenger.deliver(:a_message, System::Int32.to_clr_type).should.equal 0
142
+ end
143
+
144
+ describe "when an expectation with a return value has been defined" do
145
+
146
+ before do
147
+ @messenger = Caricature::ClrInterfaceMessenger.new ReturnValueExpectations.new
148
+ end
149
+
150
+ it "should return the a value when specified by the expecation" do
151
+ @messenger.deliver(:a_message, nil).should.not.be.nil
152
+ end
153
+
154
+ it "should return the value specified by the expecation" do
155
+ @messenger.deliver(:a_message, nil).should.equal 5
156
+ end
157
+
158
+ it "should not call super_before before executing the expectation" do
159
+ @messenger.deliver(:a_message, nil)
160
+ @messenger.expectations.expectation.should.not.have_called_super_before
161
+ end
162
+
163
+ it "should not call call_super? after executing the expectation" do
164
+ @messenger.deliver(:a_message, nil)
165
+ @messenger.expectations.expectation.should.not.have_called_call_super
166
+ end
167
+
168
+ end
169
+
170
+ end
171
+
172
+ end
@@ -13,13 +13,13 @@ describe "MethodCallRecorder" do
13
13
  end
14
14
 
15
15
  it "should have 1 method call" do
16
- @recorder.method_calls.size.should.equal 1
16
+ @recorder.method_calls[:instance].size.should.equal 1
17
17
  end
18
18
 
19
19
  describe "recorded call" do
20
20
 
21
21
  before do
22
- @mc = @recorder.method_calls[:my_method]
22
+ @mc = @recorder.method_calls[:instance][:my_method]
23
23
  end
24
24
 
25
25
  it "should have a method call collected" do
@@ -56,13 +56,13 @@ describe "MethodCallRecorder" do
56
56
  end
57
57
 
58
58
  it "should have 1 method call" do
59
- @recorder.method_calls.size.should.equal 1
59
+ @recorder.method_calls[:instance].size.should.equal 1
60
60
  end
61
61
 
62
62
  describe "recorded call" do
63
63
 
64
64
  before do
65
- @mc = @recorder.method_calls[:my_method]
65
+ @mc = @recorder.method_calls[:instance][:my_method]
66
66
  end
67
67
 
68
68
  it "should have a method call collected" do
@@ -96,17 +96,17 @@ describe "MethodCallRecorder" do
96
96
  describe "when recording a call 1 argument" do
97
97
 
98
98
  before do
99
- @recorder.record_call :my_method, 1
99
+ @recorder.record_call :my_method, :instance, 1
100
100
  end
101
101
 
102
102
  it "should have 1 method call" do
103
- @recorder.method_calls.size.should.equal 1
103
+ @recorder.method_calls[:instance].size.should.equal 1
104
104
  end
105
105
 
106
106
  describe "recorded call" do
107
107
 
108
108
  before do
109
- @mc = @recorder.method_calls[:my_method]
109
+ @mc = @recorder.method_calls[:instance][:my_method]
110
110
  end
111
111
 
112
112
  it "should have a method call collected" do
@@ -140,17 +140,17 @@ describe "MethodCallRecorder" do
140
140
  describe "when recording a call 2 arguments" do
141
141
 
142
142
  before do
143
- @recorder.record_call :my_method, 1, 2
143
+ @recorder.record_call :my_method, :instance, 1, 2
144
144
  end
145
145
 
146
146
  it "should have 1 method call" do
147
- @recorder.method_calls.size.should.equal 1
147
+ @recorder.method_calls[:instance].size.should.equal 1
148
148
  end
149
149
 
150
150
  describe "recorded call" do
151
151
 
152
152
  before do
153
- @mc = @recorder.method_calls[:my_method]
153
+ @mc = @recorder.method_calls[:instance][:my_method]
154
154
  end
155
155
 
156
156
  it "should have a method call collected" do
@@ -189,13 +189,13 @@ describe "MethodCallRecorder" do
189
189
  end
190
190
 
191
191
  it "should have 1 method call" do
192
- @recorder.method_calls.size.should.equal 1
192
+ @recorder.method_calls[:instance].size.should.equal 1
193
193
  end
194
194
 
195
195
  describe "recorded call" do
196
196
 
197
197
  before do
198
- @mc = @recorder.method_calls[:my_method]
198
+ @mc = @recorder.method_calls[:instance][:my_method]
199
199
  end
200
200
 
201
201
  it "should have a method call collected" do
@@ -226,17 +226,17 @@ describe "MethodCallRecorder" do
226
226
 
227
227
  before do
228
228
  @recorder.record_call :my_method
229
- @recorder.record_call :my_method, 1, 3, 4
229
+ @recorder.record_call :my_method, :instance, 1, 3, 4
230
230
  end
231
231
 
232
232
  it "should have 1 method call" do
233
- @recorder.method_calls.size.should.equal 1
233
+ @recorder.method_calls[:instance].size.should.equal 1
234
234
  end
235
235
 
236
236
  describe "recorded call" do
237
237
 
238
238
  before do
239
- @mc = @recorder.method_calls[:my_method]
239
+ @mc = @recorder.method_calls[:instance][:my_method]
240
240
  end
241
241
 
242
242
  it "should have a method call collected" do
@@ -267,28 +267,28 @@ describe "MethodCallRecorder" do
267
267
 
268
268
  before do
269
269
  @recorder.record_call :my_method
270
- @recorder.record_call :my_method, 1, 3, 4
270
+ @recorder.record_call :my_method, :instance, 1, 3, 4
271
271
  end
272
272
 
273
273
  it "should confirm when we don't care about the arguments" do
274
- @recorder.was_called?(:my_method, :any).should.be.true?
274
+ @recorder.was_called?(:my_method, :instance, :any).should.be.true?
275
275
  end
276
276
 
277
277
  it "should confirm when there are no argument variations" do
278
278
  @recorder.record_call :another_method
279
- @recorder.was_called?(:another_method, :any).should.be.true?
279
+ @recorder.was_called?(:another_method, :instance, :any).should.be.true?
280
280
  end
281
281
 
282
282
  it "should be negative when we provide the wrong arguments" do
283
- @recorder.was_called?(:my_method, 1, 2, 5).should.be.false?
283
+ @recorder.was_called?(:my_method, :instance, 1, 2, 5).should.be.false?
284
284
  end
285
285
 
286
286
  it "should be positive when we provide the correct arguments" do
287
- @recorder.was_called?(:my_method, 1, 3, 4).should.be.true?
287
+ @recorder.was_called?(:my_method, :instance, 1, 3, 4).should.be.true?
288
288
  end
289
289
 
290
290
  it "should be positive when we provide no arguments and a call had been recorded without arguments" do
291
- @recorder.was_called?(:my_method).should.be.true?
291
+ @recorder.was_called?(:my_method, :instance).should.be.true?
292
292
  end
293
293
  end
294
294
 
@@ -0,0 +1,185 @@
1
+ using System;
2
+
3
+ namespace ClrModels{
4
+ public interface IWeapon{
5
+ int Attack(IWarrior warrior);
6
+ int Damage();
7
+ }
8
+
9
+ public interface IWarrior
10
+ {
11
+
12
+ int Id { get; }
13
+ string Name { get; set; }
14
+ bool IsKilledBy(IWeapon weapon);
15
+ int Attack(IWarrior target, IWeapon weapon);
16
+ int SurviveAttackWith(IWeapon weapon);
17
+ }
18
+
19
+ public interface IExposing {
20
+ event EventHandler<EventArgs> IsExposedChanged;
21
+ bool IsExposed {get; set; }
22
+ }
23
+
24
+ public interface IExposingBridge : IWarrior, IExposing {
25
+ void SomeMethod();
26
+ }
27
+
28
+ public interface IExposingWarrior : IExposingBridge {
29
+ void OwnMethod();
30
+ }
31
+
32
+ public class ExposingWarrior : IExposingWarrior{
33
+ private readonly int _id;
34
+
35
+ public string Name { get; set; }
36
+ public int Id { get { return _id; } }
37
+
38
+ public int Attack(IWarrior target, IWeapon weapon){
39
+ return weapon.Attack(target);
40
+ }
41
+
42
+ public bool IsKilledBy(IWeapon weapon)
43
+ {
44
+ return weapon.Damage() > 3;
45
+ }
46
+
47
+ public event EventHandler<EventArgs> IsExposedChanged;
48
+ public bool IsExposed {get; set; }
49
+
50
+ public void SomeMethod(){}
51
+ public void OwnMethod(){
52
+
53
+ }
54
+
55
+ private int _life = 10;
56
+ public int SurviveAttackWith(IWeapon weapon){
57
+ return _life - weapon.Damage();
58
+ }
59
+
60
+ public void ChangeIsExposed(){
61
+ IsExposed = !IsExposed;
62
+ var handler = IsExposedChanged;
63
+ if(handler != null){
64
+ handler(this, EventArgs.Empty);
65
+ }
66
+ }
67
+
68
+ public bool HasEventSubscriptions{ get { return IsExposedChanged != null; } }
69
+ }
70
+
71
+ public class ExposedChangedSubscriber{
72
+
73
+ private readonly IExposingWarrior _warrior;
74
+
75
+ public ExposedChangedSubscriber(IExposingWarrior warrior){
76
+ _warrior = warrior;
77
+ _warrior.IsExposedChanged += OnExposedChanged;
78
+ }
79
+
80
+ public int Counter { get; set; }
81
+
82
+ private void OnExposedChanged(object sender, EventArgs args){
83
+ Counter++;
84
+ }
85
+
86
+ }
87
+
88
+ public class Sword : IWeapon{
89
+
90
+ public int Attack(IWarrior warrior){
91
+ return warrior.SurviveAttackWith(this);
92
+ }
93
+
94
+ public int Damage(){
95
+ return 4;
96
+ }
97
+ }
98
+
99
+ public class SwordWithStatics : Sword{
100
+
101
+ static SwordWithStatics(){
102
+ ClassNaming = "Sword with statics";
103
+ }
104
+
105
+ public SwordWithStatics(){ SwordName = "Sword name for statics"; }
106
+
107
+ public void AnotherMethod(){}
108
+ public static void AStaticMethod(){}
109
+ public static string ClassNaming { get; set; }
110
+ public string SwordName{get; set;}
111
+ }
112
+
113
+ public class Ninja : IWarrior{
114
+
115
+ public Ninja(){
116
+ Name = "Tony the Ninja";
117
+ _id = 1;
118
+ }
119
+
120
+ private readonly int _id;
121
+
122
+ public string Name { get; set; }
123
+ public int Id { get { return _id; } }
124
+
125
+ public int Attack(IWarrior target, IWeapon weapon){
126
+ return weapon.Attack(target);
127
+ }
128
+
129
+ public bool IsKilledBy(IWeapon weapon)
130
+ {
131
+ return weapon.Damage() > 3;
132
+ }
133
+
134
+ private int _life = 10;
135
+ public virtual int SurviveAttackWith(IWeapon weapon){
136
+ return _life - weapon.Damage();
137
+ }
138
+
139
+
140
+ }
141
+
142
+ public sealed class Samurai : IWarrior{
143
+
144
+ private readonly int _id;
145
+
146
+ public string Name { get; set; }
147
+ public int Id { get { return _id; } }
148
+
149
+ public int Attack(IWarrior target, IWeapon weapon){
150
+ return weapon.Attack(target);
151
+ }
152
+
153
+ public bool IsKilledBy(IWeapon weapon)
154
+ {
155
+ return weapon.Damage() > 5;
156
+ }
157
+
158
+ private int _life = 10;
159
+ public int SurviveAttackWith(IWeapon weapon){
160
+ return _life - weapon.Damage();
161
+ }
162
+
163
+
164
+ }
165
+
166
+ public class MyClassWithAStatic{
167
+
168
+ public string HelloWorld(){
169
+ return "Hello World!";
170
+ }
171
+
172
+ public static string GoodByeWorld(){
173
+ return "Goodbye world!";
174
+ }
175
+ }
176
+
177
+
178
+
179
+ public class StaticCaller{
180
+
181
+ public string CallsStatic(){
182
+ return MyClassWithAStatic.GoodByeWorld();
183
+ }
184
+ }
185
+ }
@@ -72,7 +72,7 @@ describe "Caricature::Verification" do
72
72
  before do
73
73
  @rec = Caricature::MethodCallRecorder.new
74
74
  @rec.record_call :my_method
75
- @rec.record_call :my_method, 1, 2, 3
75
+ @rec.record_call :my_method, :instance, 1, 2, 3
76
76
  @rec.record_call :another_method
77
77
 
78
78
  end
@@ -0,0 +1,30 @@
1
+ using System;
2
+ using System.Reflection;
3
+
4
+ namespace Workarounds
5
+ {
6
+ public static class ReflectionHelper
7
+ {
8
+
9
+ public static PropertyInfo[] GetInstanceProperties(Type target)
10
+ {
11
+ return target.GetProperties(BindingFlags.Public | BindingFlags.Instance);
12
+ }
13
+
14
+ public static PropertyInfo[] GetClassProperties(Type target)
15
+ {
16
+ return target.GetProperties(BindingFlags.Public | BindingFlags.Static);
17
+ }
18
+
19
+ public static MethodInfo[] GetInstanceMethods(Type target)
20
+ {
21
+ return target.GetMethods(BindingFlags.Public | BindingFlags.Instance);
22
+ }
23
+
24
+ public static MethodInfo[] GetClassMethods(Type target)
25
+ {
26
+ return target.GetMethods(BindingFlags.Public | BindingFlags.Static);
27
+ }
28
+
29
+ }
30
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caricature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Porto Carrero
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-16 00:00:00 +02:00
12
+ date: 2009-05-19 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,7 +22,136 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.markdown
24
24
  files:
25
+ - .gitignore
25
26
  - README.markdown
27
+ - Rakefile
28
+ - VERSION
29
+ - caricature.gemspec
30
+ - doc/Array.html
31
+ - doc/Caricature.html
32
+ - doc/Caricature/ArgumentRecording.html
33
+ - doc/Caricature/ClrClassDescriptor.html
34
+ - doc/Caricature/ClrClassMessenger.html
35
+ - doc/Caricature/ClrInterfaceDescriptor.html
36
+ - doc/Caricature/ClrInterfaceIsolator.html
37
+ - doc/Caricature/ClrInterfaceMessenger.html
38
+ - doc/Caricature/ClrIsolator.html
39
+ - doc/Caricature/Expectation.html
40
+ - doc/Caricature/ExpectationBuilder.html
41
+ - doc/Caricature/ExpectationSyntax.html
42
+ - doc/Caricature/Expectations.html
43
+ - doc/Caricature/Interception.html
44
+ - doc/Caricature/Interception/ClassMethods.html
45
+ - doc/Caricature/Isolation.html
46
+ - doc/Caricature/Isolator.html
47
+ - doc/Caricature/MemberDescriptor.html
48
+ - doc/Caricature/Messenger.html
49
+ - doc/Caricature/MethodCallRecorder.html
50
+ - doc/Caricature/MethodCallRecording.html
51
+ - doc/Caricature/RubyIsolator.html
52
+ - doc/Caricature/RubyMessenger.html
53
+ - doc/Caricature/RubyObjectDescriptor.html
54
+ - doc/Caricature/TypeDescriptor.html
55
+ - doc/Caricature/Verification.html
56
+ - doc/Class.html
57
+ - doc/Hash.html
58
+ - doc/Module.html
59
+ - doc/Object.html
60
+ - doc/README_markdown.html
61
+ - doc/String.html
62
+ - doc/System.html
63
+ - doc/System/String.html
64
+ - doc/System/Type.html
65
+ - doc/created.rid
66
+ - doc/images/brick.png
67
+ - doc/images/brick_link.png
68
+ - doc/images/bug.png
69
+ - doc/images/bullet_black.png
70
+ - doc/images/bullet_toggle_minus.png
71
+ - doc/images/bullet_toggle_plus.png
72
+ - doc/images/date.png
73
+ - doc/images/find.png
74
+ - doc/images/loadingAnimation.gif
75
+ - doc/images/macFFBgHack.png
76
+ - doc/images/package.png
77
+ - doc/images/page_green.png
78
+ - doc/images/page_white_text.png
79
+ - doc/images/page_white_width.png
80
+ - doc/images/plugin.png
81
+ - doc/images/ruby.png
82
+ - doc/images/tag_green.png
83
+ - doc/images/wrench.png
84
+ - doc/images/wrench_orange.png
85
+ - doc/images/zoom.png
86
+ - doc/index.html
87
+ - doc/js/darkfish.js
88
+ - doc/js/jquery.js
89
+ - doc/js/quicksearch.js
90
+ - doc/js/thickbox-compressed.js
91
+ - doc/lib/caricature/clr/descriptor_rb.html
92
+ - doc/lib/caricature/clr/isolation_rb.html
93
+ - doc/lib/caricature/clr/isolator_rb.html
94
+ - doc/lib/caricature/clr/messenger_rb.html
95
+ - doc/lib/caricature/clr_rb.html
96
+ - doc/lib/caricature/descriptor_rb.html
97
+ - doc/lib/caricature/expectation_rb.html
98
+ - doc/lib/caricature/isolation_rb.html
99
+ - doc/lib/caricature/isolator_rb.html
100
+ - doc/lib/caricature/messaging_rb.html
101
+ - doc/lib/caricature/method_call_recorder_rb.html
102
+ - doc/lib/caricature/verification_rb.html
103
+ - doc/lib/caricature_rb.html
104
+ - doc/lib/core_ext/array_rb.html
105
+ - doc/lib/core_ext/class_rb.html
106
+ - doc/lib/core_ext/core_ext_rb.html
107
+ - doc/lib/core_ext/hash_rb.html
108
+ - doc/lib/core_ext/module_rb.html
109
+ - doc/lib/core_ext/object_rb.html
110
+ - doc/lib/core_ext/string_rb.html
111
+ - doc/lib/core_ext/system/string_rb.html
112
+ - doc/lib/core_ext/system/type_rb.html
113
+ - doc/rdoc.css
114
+ - irb_init.rb
115
+ - lib/bin/Workarounds.dll
116
+ - lib/bin/Workarounds.pdb
117
+ - lib/caricature.rb
118
+ - lib/caricature/clr.rb
119
+ - lib/caricature/clr/descriptor.rb
120
+ - lib/caricature/clr/isolation.rb
121
+ - lib/caricature/clr/isolator.rb
122
+ - lib/caricature/clr/messenger.rb
123
+ - lib/caricature/descriptor.rb
124
+ - lib/caricature/expectation.rb
125
+ - lib/caricature/isolation.rb
126
+ - lib/caricature/isolator.rb
127
+ - lib/caricature/messenger.rb
128
+ - lib/caricature/method_call_recorder.rb
129
+ - lib/caricature/verification.rb
130
+ - lib/core_ext/array.rb
131
+ - lib/core_ext/class.rb
132
+ - lib/core_ext/core_ext.rb
133
+ - lib/core_ext/hash.rb
134
+ - lib/core_ext/module.rb
135
+ - lib/core_ext/object.rb
136
+ - lib/core_ext/string.rb
137
+ - lib/core_ext/system/string.rb
138
+ - lib/core_ext/system/type.rb
139
+ - pkg/.gitignore
140
+ - pkg/caricature-0.1.0.gem
141
+ - spec/bacon_helper.rb
142
+ - spec/bin/.gitignore
143
+ - spec/core_ext_spec.rb
144
+ - spec/descriptor_spec.rb
145
+ - spec/expectation_spec.rb
146
+ - spec/integration_spec.rb
147
+ - spec/interop_spec.rb
148
+ - spec/isolation_spec.rb
149
+ - spec/isolator_spec.rb
150
+ - spec/messaging_spec.rb
151
+ - spec/method_call_spec.rb
152
+ - spec/models/ClrModels.cs
153
+ - spec/verification_spec.rb
154
+ - workarounds/ReflectionHelper.cs
26
155
  has_rdoc: true
27
156
  homepage: http://github.com/casualjim/caricature
28
157
  licenses: []
@@ -54,10 +183,12 @@ summary: Caricature - Bringing simple mocking to the DLR
54
183
  test_files:
55
184
  - spec/bacon_helper.rb
56
185
  - spec/core_ext_spec.rb
186
+ - spec/descriptor_spec.rb
57
187
  - spec/expectation_spec.rb
58
188
  - spec/integration_spec.rb
59
189
  - spec/interop_spec.rb
60
190
  - spec/isolation_spec.rb
61
191
  - spec/isolator_spec.rb
192
+ - spec/messaging_spec.rb
62
193
  - spec/method_call_spec.rb
63
194
  - spec/verification_spec.rb