This repository has been archived by the owner on Dec 30, 2020. It is now read-only.
/
Moq.xml
3314 lines (3261 loc) · 159 KB
/
Moq.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<doc>
<assembly>
<name>Moq</name>
</assembly>
<members>
<member name="T:Moq.EmptyDefaultValueProvider">
<summary>
A <see cref="T:Moq.IDefaultValueProvider"/> that returns an empty default value
for invocations that do not have setups or return values, with loose mocks.
This is the default behavior for a mock.
</summary>
</member>
<member name="T:Moq.IDefaultValueProvider">
<summary>
Interface to be implemented by classes that determine the
default value of non-expected invocations.
</summary>
</member>
<member name="M:Moq.IDefaultValueProvider.ProvideDefault(System.Reflection.MethodInfo)">
<summary>
Provides a value for the given member and arguments.
</summary>
<param name="member">The member to provide a default
value for.</param>
</member>
<member name="T:Moq.Language.Flow.IReturnsResult`1">
<summary>
Implements the fluent API.
</summary>
</member>
<member name="T:Moq.Language.ICallback">
<summary>
Defines the <c>Callback</c> verb and overloads.
</summary>
</member>
<member name="T:Moq.IHideObjectMembers">
<summary>
Helper interface used to hide the base <see cref="T:System.Object"/>
members from the fluent API to make it much cleaner
in Visual Studio intellisense.
</summary>
</member>
<member name="M:Moq.IHideObjectMembers.GetType">
<summary/>
</member>
<member name="M:Moq.IHideObjectMembers.GetHashCode">
<summary/>
</member>
<member name="M:Moq.IHideObjectMembers.ToString">
<summary/>
</member>
<member name="M:Moq.IHideObjectMembers.Equals(System.Object)">
<summary/>
</member>
<member name="M:Moq.Language.ICallback.Callback(System.Action)">
<summary>
Specifies a callback to invoke when the method is called.
</summary>
<param name="action">Callback method to invoke.</param>
<example>
The following example specifies a callback to set a boolean
value that can be used later:
<code>
bool called = false;
mock.Setup(x => x.Execute())
.Callback(() => called = true);
</code>
</example>
</member>
<member name="M:Moq.Language.ICallback.Callback``1(System.Action{``0})">
<summary>
Specifies a callback to invoke when the method is called that receives the original
arguments.
</summary>
<typeparam name="T">Argument type of the invoked method.</typeparam>
<param name="action">Callback method to invoke.</param>
<example>
Invokes the given callback with the concrete invocation argument value.
<para>
Notice how the specific string argument is retrieved by simply declaring
it as part of the lambda expression for the callback:
</para>
<code>
mock.Setup(x => x.Execute(It.IsAny<string>()))
.Callback((string command) => Console.WriteLine(command));
</code>
</example>
</member>
<member name="M:Moq.Language.ICallback.Callback``2(System.Action{``0,``1})">
<summary>
Specifies a callback to invoke when the method is called that receives the original
arguments.
</summary>
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
<param name="action">Callback method to invoke.</param>
<example>
Invokes the given callback with the concrete invocation arguments values.
<para>
Notice how the specific arguments are retrieved by simply declaring
them as part of the lambda expression for the callback:
</para>
<code>
mock.Setup(x => x.Execute(
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2));
</code>
</example>
</member>
<member name="M:Moq.Language.ICallback.Callback``3(System.Action{``0,``1,``2})">
<summary>
Specifies a callback to invoke when the method is called that receives the original
arguments.
</summary>
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
<param name="action">Callback method to invoke.</param>
<example>
Invokes the given callback with the concrete invocation arguments values.
<para>
Notice how the specific arguments are retrieved by simply declaring
them as part of the lambda expression for the callback:
</para>
<code>
mock.Setup(x => x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<int>()))
.Callback((string arg1, string arg2, int arg3) => Console.WriteLine(arg1 + arg2 + arg3));
</code>
</example>
</member>
<member name="M:Moq.Language.ICallback.Callback``4(System.Action{``0,``1,``2,``3})">
<summary>
Specifies a callback to invoke when the method is called that receives the original
arguments.
</summary>
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
<typeparam name="T4">Type of the fourth argument of the invoked method.</typeparam>
<param name="action">Callback method to invoke.</param>
<example>
Invokes the given callback with the concrete invocation arguments values.
<para>
Notice how the specific arguments are retrieved by simply declaring
them as part of the lambda expression for the callback:
</para>
<code>
mock.Setup(x => x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<int>(),
It.IsAny<bool>()))
.Callback((string arg1, string arg2, int arg3, bool arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
</code>
</example>
</member>
<member name="T:Moq.Language.IOccurrence">
<summary>
Defines occurrence members to constraint setups.
</summary>
</member>
<member name="M:Moq.Language.IOccurrence.AtMostOnce">
<summary>
The expected invocation can happen at most once.
</summary>
<example>
<code>
var mock = new Mock<ICommand>();
mock.Setup(foo => foo.Execute("ping"))
.AtMostOnce();
</code>
</example>
</member>
<member name="M:Moq.Language.IOccurrence.AtMost(System.Int32)">
<summary>
The expected invocation can happen at most specified number of times.
</summary>
<param name="callCount">The number of times to accept calls.</param>
<example>
<code>
var mock = new Mock<ICommand>();
mock.Setup(foo => foo.Execute("ping"))
.AtMost( 5 );
</code>
</example>
</member>
<member name="T:Moq.Language.IRaise`1">
<summary>
Defines the <c>Raises</c> verb.
</summary>
</member>
<member name="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)">
<summary>
Specifies the event that will be raised
when the setup is met.
</summary>
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
<param name="args">The event arguments to pass for the raised event.</param>
<example>
The following example shows how to raise an event when
the setup is met:
<code>
var mock = new Mock<IContainer>();
mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>()))
.Raises(add => add.Added += null, EventArgs.Empty);
</code>
</example>
</member>
<member name="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.Func{System.EventArgs})">
<summary>
Specifies the event that will be raised
when the setup is matched.
</summary>
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise`1.Raises``1(System.Action{`0},System.Func{``0,System.EventArgs})">
<summary>
Specifies the event that will be raised
when the setup is matched.
</summary>
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<typeparam name="T1">Type of the argument received by the expected invocation.</typeparam>
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise`1.Raises``2(System.Action{`0},System.Func{``0,``1,System.EventArgs})">
<summary>
Specifies the event that will be raised
when the setup is matched.
</summary>
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise`1.Raises``3(System.Action{`0},System.Func{``0,``1,``2,System.EventArgs})">
<summary>
Specifies the event that will be raised
when the setup is matched.
</summary>
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
<typeparam name="T3">Type of the third argument received by the expected invocation.</typeparam>
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise`1.Raises``4(System.Action{`0},System.Func{``0,``1,``2,``3,System.EventArgs})">
<summary>
Specifies the event that will be raised
when the setup is matched.
</summary>
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
<typeparam name="T3">Type of the third argument received by the expected invocation.</typeparam>
<typeparam name="T4">Type of the fourth argument received by the expected invocation.</typeparam>
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.Object[])">
<summary>
Specifies the custom event that will be raised
when the setup is matched.
</summary>
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
<param name="args">The arguments to pass to the custom delegate (non EventHandler-compatible).</param>
</member>
<member name="T:Moq.Language.IRaise">
<summary>
Defines the <c>Raises</c> verb.
</summary>
</member>
<member name="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)">
<summary>
Specifies the mocked event that will be raised
when the setup is met.
</summary>
<param name="eventHandler">The mocked event, retrieved from
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
</param>
<param name="args">The event args to pass when raising the event.</param>
<example>
The following example shows how to raise an event when
the setup is met:
<code>
var mock = new Mock<IContainer>();
// create handler to associate with the event to raise
var handler = mock.CreateEventHandler();
// associate the handler with the event to raise
mock.Object.Added += handler;
// setup the invocation and the handler to raise
mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>()))
.Raises(handler, EventArgs.Empty);
</code>
</example>
</member>
<member name="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.Func{System.EventArgs})">
<summary>
Specifies the mocked event that will be raised
when the setup is matched.
</summary>
<param name="eventHandler">The mocked event, retrieved from
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise.Raises``1(Moq.MockedEvent,System.Func{``0,System.EventArgs})">
<summary>
Specifies the mocked event that will be raised
when the setup is matched.
</summary>
<param name="eventHandler">The mocked event, retrieved from
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<typeparam name="T">Type of the argument received by the expected invocation.</typeparam>
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise.Raises``2(Moq.MockedEvent,System.Func{``0,``1,System.EventArgs})">
<summary>
Specifies the mocked event that will be raised
when the setup is matched.
</summary>
<param name="eventHandler">The mocked event, retrieved from
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise.Raises``3(Moq.MockedEvent,System.Func{``0,``1,``2,System.EventArgs})">
<summary>
Specifies the mocked event that will be raised
when the setup is matched.
</summary>
<param name="eventHandler">The mocked event, retrieved from
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
<typeparam name="T3">Type of the third argument received by the expected invocation.</typeparam>
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
</member>
<member name="M:Moq.Language.IRaise.Raises``4(Moq.MockedEvent,System.Func{``0,``1,``2,``3,System.EventArgs})">
<summary>
Specifies the mocked event that will be raised
when the setup is matched.
</summary>
<param name="eventHandler">The mocked event, retrieved from
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
</param>
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
to pass when raising the event.</param>
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
<typeparam name="T3">Type of the third argument received by the expected invocation.</typeparam>
<typeparam name="T4">Type of the fourth argument received by the expected invocation.</typeparam>
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
</member>
<member name="T:Moq.Language.IVerifies">
<summary>
Defines the <c>Verifiable</c> verb.
</summary>
</member>
<member name="M:Moq.Language.IVerifies.Verifiable">
<summary>
Marks the expectation as verifiable, meaning that a call
to <see cref="M:Moq.Mock.Verify"/> will check if this particular
expectation was met.
</summary>
<example>
The following example marks the expectation as verifiable:
<code>
mock.Expect(x => x.Execute("ping"))
.Returns(true)
.Verifiable();
</code>
</example>
</member>
<member name="M:Moq.Language.IVerifies.Verifiable(System.String)">
<summary>
Marks the expectation as verifiable, meaning that a call
to <see cref="M:Moq.Mock.Verify"/> will check if this particular
expectation was met, and specifies a message for failures.
</summary>
<example>
The following example marks the expectation as verifiable:
<code>
mock.Expect(x => x.Execute("ping"))
.Returns(true)
.Verifiable("Ping should be executed always!");
</code>
</example>
</member>
<member name="T:Moq.MatcherAttribute">
<summary>
Marks a method as a matcher, which allows complete replacement
of the built-in <see cref="T:Moq.It"/> class with your own argument
matching rules.
</summary>
<remarks>
<b>This feature has been deprecated in favor of the new
and simpler <see cref="T:Moq.Match`1"/>.
</b>
<para>
The argument matching is used to determine whether a concrete
invocation in the mock matches a given setup. This
matching mechanism is fully extensible.
</para>
<para>
There are two parts of a matcher: the compiler matcher
and the runtime matcher.
<list type="bullet">
<item>
<term>Compiler matcher</term>
<description>Used to satisfy the compiler requirements for the
argument. Needs to be a method optionally receiving any arguments
you might need for the matching, but with a return type that
matches that of the argument.
<para>
Let's say I want to match a lists of orders that contains
a particular one. I might create a compiler matcher like the following:
</para>
<code>
public static class Orders
{
[Matcher]
public static IEnumerable<Order> Contains(Order order)
{
return null;
}
}
</code>
Now we can invoke this static method instead of an argument in an
invocation:
<code>
var order = new Order { ... };
var mock = new Mock<IRepository<Order>>();
mock.Setup(x => x.Save(Orders.Contains(order)))
.Throws<ArgumentException>();
</code>
Note that the return value from the compiler matcher is irrelevant.
This method will never be called, and is just used to satisfy the
compiler and to signal Moq that this is not a method that we want
to be invoked at runtime.
</description>
</item>
<item>
<term>Runtime matcher</term>
<description>
The runtime matcher is the one that will actually perform evaluation
when the test is run, and is defined by convention to have the
same signature as the compiler matcher, but where the return
value is the first argument to the call, which contains the
object received by the actual invocation at runtime:
<code>
public static bool Contains(IEnumerable<Order> orders, Order order)
{
return orders.Contains(order);
}
</code>
At runtime, the mocked method will be invoked with a specific
list of orders. This value will be passed to this runtime
matcher as the first argument, while the second argument is the
one specified in the setup (<c>x.Save(Orders.Contains(order))</c>).
<para>
The boolean returned determines whether the given argument has been
matched. If all arguments to the expected method are matched, then
the setup matches and is evaluated.
</para>
</description>
</item>
</list>
</para>
Using this extensible infrastructure, you can easily replace the entire
<see cref="T:Moq.It"/> set of matchers with your own. You can also avoid the
typical (and annoying) lengthy expressions that result when you have
multiple arguments that use generics.
</remarks>
<example>
The following is the complete example explained above:
<code>
public static class Orders
{
[Matcher]
public static IEnumerable<Order> Contains(Order order)
{
return null;
}
public static bool Contains(IEnumerable<Order> orders, Order order)
{
return orders.Contains(order);
}
}
</code>
And the concrete test using this matcher:
<code>
var order = new Order { ... };
var mock = new Mock<IRepository<Order>>();
mock.Setup(x => x.Save(Orders.Contains(order)))
.Throws<ArgumentException>();
// use mock, invoke Save, and have the matcher filter.
</code>
</example>
</member>
<member name="M:Moq.ExpressionExtensions.ToLambda(System.Linq.Expressions.Expression)">
<summary>
Casts the expression to a lambda expression, removing
a cast if there's any.
</summary>
</member>
<member name="M:Moq.ExpressionExtensions.ToMethodCall(System.Linq.Expressions.LambdaExpression)">
<summary>
Casts the body of the lambda expression to a <see cref="T:System.Linq.Expressions.MethodCallExpression"/>.
</summary>
<exception cref="T:System.ArgumentException">If the body is not a method call.</exception>
</member>
<member name="M:Moq.ExpressionExtensions.ToPropertyInfo(System.Linq.Expressions.LambdaExpression)">
<summary>
Converts the body of the lambda expression into the <see cref="T:System.Reflection.PropertyInfo"/> referenced by it.
</summary>
</member>
<member name="M:Moq.ExpressionExtensions.IsProperty(System.Linq.Expressions.LambdaExpression)">
<summary>
Checks whether the body of the lambda expression is a property access.
</summary>
</member>
<member name="M:Moq.ExpressionExtensions.IsProperty(System.Linq.Expressions.Expression)">
<summary>
Checks whether the expression is a property access.
</summary>
</member>
<member name="M:Moq.ExpressionExtensions.IsPropertyIndexer(System.Linq.Expressions.LambdaExpression)">
<summary>
Checks whether the body of the lambda expression is a property indexer, which is true
when the expression is an <see cref="T:System.Linq.Expressions.MethodCallExpression"/> whose
<see cref="P:System.Linq.Expressions.MethodCallExpression.Method"/> has <see cref="P:System.Reflection.MethodBase.IsSpecialName"/>
equal to <see langword="true"/>.
</summary>
</member>
<member name="M:Moq.ExpressionExtensions.IsPropertyIndexer(System.Linq.Expressions.Expression)">
<summary>
Checks whether the expression is a property indexer, which is true
when the expression is an <see cref="T:System.Linq.Expressions.MethodCallExpression"/> whose
<see cref="P:System.Linq.Expressions.MethodCallExpression.Method"/> has <see cref="P:System.Reflection.MethodBase.IsSpecialName"/>
equal to <see langword="true"/>.
</summary>
</member>
<member name="M:Moq.ExpressionExtensions.CastTo``1(System.Linq.Expressions.Expression)">
<summary>
Creates an expression that casts the given expression to the <typeparamref name="T"/>
type.
</summary>
</member>
<member name="M:Moq.ExpressionExtensions.ToStringFixed(System.Linq.Expressions.Expression)">
<devdoc>
TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583
is fixed.
</devdoc>
</member>
<member name="T:Moq.Evaluator">
<summary>
Provides partial evaluation of subtrees, whenever they can be evaluated locally.
</summary>
<author>Matt Warren: http://blogs.msdn.com/mattwar</author>
<contributor>Documented by InSTEDD: http://www.instedd.org</contributor>
</member>
<member name="M:Moq.Evaluator.PartialEval(System.Linq.Expressions.Expression,System.Func{System.Linq.Expressions.Expression,System.Boolean})">
<summary>
Performs evaluation and replacement of independent sub-trees
</summary>
<param name="expression">The root of the expression tree.</param>
<param name="fnCanBeEvaluated">A function that decides whether a given expression
node can be part of the local function.</param>
<returns>A new tree with sub-trees evaluated and replaced.</returns>
</member>
<member name="M:Moq.Evaluator.PartialEval(System.Linq.Expressions.Expression)">
<summary>
Performs evaluation and replacement of independent sub-trees
</summary>
<param name="expression">The root of the expression tree.</param>
<returns>A new tree with sub-trees evaluated and replaced.</returns>
</member>
<member name="T:Moq.Evaluator.SubtreeEvaluator">
<summary>
Evaluates and replaces sub-trees when first candidate is reached (top-down)
</summary>
</member>
<member name="T:Moq.Evaluator.Nominator">
<summary>
Performs bottom-up analysis to determine which nodes can possibly
be part of an evaluated sub-tree.
</summary>
</member>
<member name="M:Guard.ArgumentNotNull(System.Object,System.String)">
<summary>
Checks an argument to ensure it isn't null.
</summary>
<param name="value">The argument value to check.</param>
<param name="argumentName">The name of the argument.</param>
</member>
<member name="M:Guard.ArgumentNotNullOrEmptyString(System.String,System.String)">
<summary>
Checks a string argument to ensure it isn't null or empty.
</summary>
<param name="argumentValue">The argument value to check.</param>
<param name="argumentName">The name of the argument.</param>
</member>
<member name="M:Guard.ArgumentNotOutOfRangeInclusive``1(``0,``0,``0,System.String)">
<summary>
Checks an argument to ensure it is in the specified range including the edges.
</summary>
<typeparam name="T">Type of the argument to check, it must be an <see cref="T:System.IComparable"/> type.
</typeparam>
<param name="value">The argument value to check.</param>
<param name="from">The minimun allowed value for the argument.</param>
<param name="to">The maximun allowed value for the argument.</param>
<param name="argumentName">The name of the argument.</param>
</member>
<member name="M:Guard.ArgumentNotOutOfRangeExclusive``1(``0,``0,``0,System.String)">
<summary>
Checks an argument to ensure it is in the specified range excluding the edges.
</summary>
<typeparam name="T">Type of the argument to check, it must be an <see cref="T:System.IComparable"/> type.
</typeparam>
<param name="value">The argument value to check.</param>
<param name="from">The minimun allowed value for the argument.</param>
<param name="to">The maximun allowed value for the argument.</param>
<param name="argumentName">The name of the argument.</param>
</member>
<member name="T:Moq.Language.IReturnsGetter`2">
<summary>
Defines the <c>Returns</c> verb for property get setups.
</summary>
<typeparam name="TMock">Mocked type.</typeparam>
<typeparam name="TProperty">Type of the property.</typeparam>
</member>
<member name="M:Moq.Language.IReturnsGetter`2.Returns(`1)">
<summary>
Specifies the value to return.
</summary>
<param name="value">The value to return, or <see langword="null"/>.</param>
<example>
Return a <c>true</c> value from the property getter call:
<code>
mock.SetupGet(x => x.Suspended)
.Returns(true);
</code>
</example>
</member>
<member name="M:Moq.Language.IReturnsGetter`2.Returns(System.Func{`1})">
<summary>
Specifies a function that will calculate the value to return for the property.
</summary>
<param name="valueFunction">The function that will calculate the return value.</param>
<example>
Return a calculated value when the property is retrieved:
<code>
mock.SetupGet(x => x.Suspended)
.Returns(() => returnValues[0]);
</code>
The lambda expression to retrieve the return value is lazy-executed,
meaning that its value may change depending on the moment the property
is retrieved and the value the <c>returnValues</c> array has at
that moment.
</example>
</member>
<member name="T:Moq.Language.ICallbackGetter`2">
<summary>
Defines the <c>Callback</c> verb for property getter setups.
</summary>
<seealso cref="M:Moq.Mock`1.SetupGet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})"/>
<typeparam name="TMock">Mocked type.</typeparam>
<typeparam name="TProperty">Type of the property.</typeparam>
</member>
<member name="M:Moq.Language.ICallbackGetter`2.Callback(System.Action)">
<summary>
Specifies a callback to invoke when the property is retrieved.
</summary>
<param name="action">Callback method to invoke.</param>
<example>
Invokes the given callback with the property value being set.
<code>
mock.SetupGet(x => x.Suspended)
.Callback(() => called = true)
.Returns(true);
</code>
</example>
</member>
<member name="T:Moq.Language.Flow.IThrowsResult">
<summary>
Implements the fluent API.
</summary>
</member>
<member name="T:Moq.Language.Flow.IReturnsThrows`2">
<summary>
Implements the fluent API.
</summary>
</member>
<member name="T:Moq.Language.IReturns`2">
<summary>
Defines the <c>Returns</c> verb.
</summary>
<typeparam name="TMock">Mocked type.</typeparam>
<typeparam name="TResult">Type of the return value from the expression.</typeparam>
</member>
<member name="M:Moq.Language.IReturns`2.Returns(`1)">
<summary>
Specifies the value to return.
</summary>
<param name="value">The value to return, or <see langword="null"/>.</param>
<example>
Return a <c>true</c> value from the method call:
<code>
mock.Setup(x => x.Execute("ping"))
.Returns(true);
</code>
</example>
</member>
<member name="M:Moq.Language.IReturns`2.Returns(System.Func{`1})">
<summary>
Specifies a function that will calculate the value to return from the method.
</summary>
<param name="valueFunction">The function that will calculate the return value.</param>
<example group="returns">
Return a calculated value when the method is called:
<code>
mock.Setup(x => x.Execute("ping"))
.Returns(() => returnValues[0]);
</code>
The lambda expression to retrieve the return value is lazy-executed,
meaning that its value may change depending on the moment the method
is executed and the value the <c>returnValues</c> array has at
that moment.
</example>
</member>
<member name="M:Moq.Language.IReturns`2.Returns``1(System.Func{``0,`1})">
<summary>
Specifies a function that will calculate the value to return from the method,
retrieving the arguments for the invocation.
</summary>
<typeparam name="T">Type of the argument of the invoked method.</typeparam>
<param name="valueFunction">The function that will calculate the return value.</param>
<example group="returns">
Return a calculated value which is evaluated lazily at the time of the invocation.
<para>
The lookup list can change between invocations and the setup
will return different values accordingly. Also, notice how the specific
string argument is retrieved by simply declaring it as part of the lambda
expression:
</para>
<code>
mock.Setup(x => x.Execute(It.IsAny<string>()))
.Returns((string command) => returnValues[command]);
</code>
</example>
</member>
<member name="M:Moq.Language.IReturns`2.Returns``2(System.Func{``0,``1,`1})">
<summary>
Specifies a function that will calculate the value to return from the method,
retrieving the arguments for the invocation.
</summary>
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
<param name="valueFunction">The function that will calculate the return value.</param>
<example group="returns">
Return a calculated value which is evaluated lazily at the time of the invocation.
<para>
The return value is calculated from the value of the actual method invocation arguments.
Notice how the arguments are retrieved by simply declaring them as part of the lambda
expression:
</para>
<code>
mock.Setup(x => x.Execute(
It.IsAny<string>(),
It.IsAny<string>()))
.Returns((string arg1, string arg2) => arg1 + arg2);
</code>
</example>
</member>
<member name="M:Moq.Language.IReturns`2.Returns``3(System.Func{``0,``1,``2,`1})">
<summary>
Specifies a function that will calculate the value to return from the method,
retrieving the arguments for the invocation.
</summary>
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
<param name="valueFunction">The function that will calculate the return value.</param>
<example group="returns">
Return a calculated value which is evaluated lazily at the time of the invocation.
<para>
The return value is calculated from the value of the actual method invocation arguments.
Notice how the arguments are retrieved by simply declaring them as part of the lambda
expression:
</para>
<code>
mock.Setup(x => x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<int>()))
.Returns((string arg1, string arg2, int arg3) => arg1 + arg2 + arg3);
</code>
</example>
</member>
<member name="M:Moq.Language.IReturns`2.Returns``4(System.Func{``0,``1,``2,``3,`1})">
<summary>
Specifies a function that will calculate the value to return from the method,
retrieving the arguments for the invocation.
</summary>
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
<typeparam name="T4">Type of the fourth argument of the invoked method.</typeparam>
<param name="valueFunction">The function that will calculate the return value.</param>
<example group="returns">
Return a calculated value which is evaluated lazily at the time of the invocation.
<para>
The return value is calculated from the value of the actual method invocation arguments.
Notice how the arguments are retrieved by simply declaring them as part of the lambda
expression:
</para>
<code>
mock.Setup(x => x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<int>(),
It.IsAny<bool>()))
.Returns((string arg1, string arg2, int arg3, bool arg4) => arg1 + arg2 + arg3 + arg4);
</code>
</example>
</member>
<member name="T:Moq.Language.IThrows">
<summary>
Defines the <c>Throws</c> verb.
</summary>
</member>
<member name="M:Moq.Language.IThrows.Throws(System.Exception)">
<summary>
Specifies the exception to throw when the method is invoked.
</summary>
<param name="exception">Exception instance to throw.</param>
<example>
This example shows how to throw an exception when the method is
invoked with an empty string argument:
<code>
mock.Setup(x => x.Execute(""))
.Throws(new ArgumentException());
</code>
</example>
</member>
<member name="M:Moq.Language.IThrows.Throws``1">
<summary>
Specifies the type of exception to throw when the method is invoked.
</summary>
<typeparam name="TException">Type of exception to instantiate and throw when the setup is matched.</typeparam>
<example>
This example shows how to throw an exception when the method is
invoked with an empty string argument:
<code>
mock.Setup(x => x.Execute(""))
.Throws<ArgumentException>();
</code>
</example>
</member>
<member name="T:Moq.Language.Flow.IReturnsThrowsGetter`2">
<summary>
Implements the fluent API.
</summary>
</member>
<member name="T:Moq.Language.Flow.ICallbackResult">
<summary>
Implements the fluent API.
</summary>
</member>
<member name="T:Moq.Language.ICallback`2">
<summary>
Defines the <c>Callback</c> verb and overloads for callbacks on
setups that return a value.
</summary>
<typeparam name="TMock">Mocked type.</typeparam>
<typeparam name="TResult">Type of the return value of the setup.</typeparam>
</member>
<member name="M:Moq.Language.ICallback`2.Callback(System.Action)">
<summary>
Specifies a callback to invoke when the method is called.
</summary>
<param name="action">Callback method to invoke.</param>
<example>
The following example specifies a callback to set a boolean
value that can be used later:
<code>
bool called = false;
mock.Setup(x => x.Execute())
.Callback(() => called = true)
.Returns(true);
</code>
Note that in the case of value-returning methods, after the <c>Callback</c>
call you can still specify the return value.
</example>
</member>
<member name="M:Moq.Language.ICallback`2.Callback``1(System.Action{``0})">
<summary>
Specifies a callback to invoke when the method is called that receives the original
arguments.
</summary>
<typeparam name="T">Type of the argument of the invoked method.</typeparam>
<param name="action">Callback method to invoke.</param>
<example>
Invokes the given callback with the concrete invocation argument value.
<para>
Notice how the specific string argument is retrieved by simply declaring
it as part of the lambda expression for the callback:
</para>
<code>
mock.Setup(x => x.Execute(It.IsAny<string>()))
.Callback((string command) => Console.WriteLine(command))
.Returns(true);
</code>
</example>
</member>
<member name="M:Moq.Language.ICallback`2.Callback``2(System.Action{``0,``1})">
<summary>
Specifies a callback to invoke when the method is called that receives the original
arguments.
</summary>
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
<param name="action">Callback method to invoke.</param>
<example>
Invokes the given callback with the concrete invocation arguments values.
<para>
Notice how the specific arguments are retrieved by simply declaring
them as part of the lambda expression for the callback:
</para>
<code>
mock.Setup(x => x.Execute(
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2))
.Returns(true);
</code>
</example>
</member>
<member name="M:Moq.Language.ICallback`2.Callback``3(System.Action{``0,``1,``2})">
<summary>
Specifies a callback to invoke when the method is called that receives the original
arguments.
</summary>
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
<param name="action">Callback method to invoke.</param>
<example>
Invokes the given callback with the concrete invocation arguments values.
<para>
Notice how the specific arguments are retrieved by simply declaring
them as part of the lambda expression for the callback:
</para>
<code>
mock.Setup(x => x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<int>()))
.Callback((string arg1, string arg2, int arg3) => Console.WriteLine(arg1 + arg2 + arg3))
.Returns(true);
</code>
</example>
</member>
<member name="M:Moq.Language.ICallback`2.Callback``4(System.Action{``0,``1,``2,``3})">
<summary>
Specifies a callback to invoke when the method is called that receives the original
arguments.
</summary>