C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just...
Transcript of C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just...
![Page 1: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1.jpg)
C#
MoqMoqNamespaceSendFeedbackRootnamespaceofMoq(pronounced"Mock-you"orjust"Mock"),theonlymockinglibraryfor.NETandSilverlightdevelopedfromscratchtotakefulladvantageof.NET3.5(i.e.Linqexpressiontrees)andC#3.0features(i.e.lambdaexpressions)thatmakeitthemostproductive,simpleandrefactoring-friendlymockinglibraryavailable.
Seetheonlinequickstartsformoreexamplesthanthoseavailableinthiscodedocumentation.
TheMock<T>classisthecoreofthelibrary,soit'sagoodplacetostart.
YoucanalsoreadblogentriesfromaroundtheworldaboutMoq.
![Page 2: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/2.jpg)
Classes Class Description
It
Allowsthespecificationofamatchingconditionforanargumentinamethodinvocation,ratherthanaspecificargumentvalue."It"referstotheargumentbeingmatched.
Mock
Baseclassformocksandstatichelperclasswithmethodsthatapplytomockedobjects,suchasGet<(Of<<'(T>)>>)(T)toretrieveaMock<(Of<(<'T>)>)>fromanobjectinstance.
Mock<(Of<(<'T>)>)> ProvidesamockimplementationofT.
MockException Exceptionthrownbymockswhensetupsarenotmatched,themockisnotproperlysetup,etc.
MockExtensions Providesadditionalmethodsonmocks.
MockFactory
Obsolete.Utilityfactoryclasstousetoconstructmultiplemockswhenconsistentverificationisdesiredforallofthem.
MockRepositoryUtilityrepositoryclasstousetoconstructmultiplemockswhenconsistentverificationisdesiredforallofthem.
MocksAllowsqueryingtheuniverseofmocksforthosethatbehaveaccordingtotheLINQqueryspecification.
MockSequence Helperclasstosetupafulltracebetweenmanymocks
MockSequenceHelper defineniceapi
SequenceExtensions Helperforsequencingreturnvaluesinthesamemethod.
![Page 3: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/3.jpg)
Structures Structure Description
Times Definesthenumberofinvocationsallowedbyamockedmethod.
![Page 4: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/4.jpg)
Enumerations Enumeration Description
DefaultValue Determinesthewaydefaultvaluesaregeneratedcalculatedforloosemocks.
MockBehavior Optionstocustomizethebehaviorofthemock.
RangeKindofrangetouseinafilterspecifiedthroughIsInRange<(Of<<'(TValue>)>>)(TValue,TValue,Range).
![Page 5: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/5.jpg)
C#
MoqDefaultValueEnumerationSeeAlsoSendFeedbackDeterminesthewaydefaultvaluesaregeneratedcalculatedforloosemocks.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 6: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/6.jpg)
SyntaxC#
publicenumDefaultValue
![Page 7: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/7.jpg)
MembersMembername DescriptionEmptyMock
![Page 9: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/9.jpg)
C#
MoqItClassMembersSeeAlsoSendFeedbackAllowsthespecificationofamatchingconditionforanargumentinamethodinvocation,ratherthanaspecificargumentvalue."It"referstotheargumentbeingmatched.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 10: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/10.jpg)
SyntaxC#
publicstaticclassIt
![Page 11: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/11.jpg)
RemarksThisclassallowsthesetuptomatchamethodinvocationwithanarbitraryvalue,withavalueinaspecifiedrange,orevenonethatmatchesagivenpredicate.
![Page 14: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/14.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqItMembersItClassMethodsSeeAlsoSendFeedback
TheIttypeexposesthefollowingmembers.
![Page 15: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/15.jpg)
Methods Name Description
Is<(Of<<'(TValue>)>>)IsAny<(Of<<'(TValue>)>>) MatchesanyvalueofthegivenTValuetype.
IsInRange<(Of<<'(TValue>)>>) Matchesanyvaluethatisintherangespecified.
IsRegex(String) Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
IsRegex(String,RegexOptions)
Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
![Page 17: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/17.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqItMethodsItClassSeeAlsoSendFeedback
TheIttypeexposesthefollowingmembers.
![Page 18: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/18.jpg)
Methods Name Description
Is<(Of<<'(TValue>)>>)IsAny<(Of<<'(TValue>)>>) MatchesanyvalueofthegivenTValuetype.
IsInRange<(Of<<'(TValue>)>>) Matchesanyvaluethatisintherangespecified.
IsRegex(String) Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
IsRegex(String,RegexOptions)
Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
![Page 20: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/20.jpg)
C#
MoqIt..::..Is<(Of<(<'TValue>)>)>MethodItClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.It.Is``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 21: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/21.jpg)
SyntaxC#
publicstaticTValueIs<TValue>(
Expression<Func>match
)
Parameters
matchType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 22: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/22.jpg)
TypeParametersTValue
![Page 24: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/24.jpg)
C#
MoqIt..::..IsAny<(Of<(<'TValue>)>)>MethodItClassExampleSeeAlsoSendFeedbackMatchesanyvalueofthegivenTValuetype.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 25: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/25.jpg)
SyntaxC#
publicstaticTValueIsAny<TValue>()
![Page 26: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/26.jpg)
TypeParametersTValue
Typeofthevalue.
![Page 27: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/27.jpg)
RemarksTypicallyusedwhentheactualargumentvalueforamethodcallisnotrelevant.
![Page 28: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/28.jpg)
Copy
ExamplesC#
//ThrowsanexceptionforacalltoRemovewithanystringvalue.
mock.Setup(x=>x.Remove(It.IsAny<string>())).Throws(newInvalidOperationException());
![Page 30: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/30.jpg)
C#
MoqIt..::..IsInRange<(Of<(<'TValue>)>)>MethodItClassExampleSeeAlsoSendFeedbackMatchesanyvaluethatisintherangespecified.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 31: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/31.jpg)
SyntaxC#
publicstaticTValueIsInRange<TValue>(
TValuefrom,
TValueto,
RangerangeKind
)
whereTValue:IComparable
Parameters
fromType:TValueThelowerboundoftherange.
toType:TValueTheupperboundoftherange.
rangeKindType:Moq..::..RangeThekindofrange.SeeRange.
![Page 32: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/32.jpg)
TypeParametersTValue
Typeoftheargumenttocheck.
![Page 33: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/33.jpg)
Copy
ExamplesThefollowingexampleshowshowtoexpectamethodcallwithanintegerargumentwithinthe0..100range.
C#
mock.Setup(x=>x.HasInventory(
It.IsAny<string>(),
It.IsInRange(0,100,Range.Inclusive)))
.Returns(false);
![Page 35: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/35.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIt..::..IsRegexMethodItClassSeeAlsoSendFeedback
![Page 36: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/36.jpg)
OverloadList Name Description
IsRegex(String) Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
IsRegex(String,RegexOptions)
Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
![Page 38: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/38.jpg)
C#
MoqIt..::..IsRegexMethod(String)ItClassExampleSeeAlsoSendFeedbackMatchesastringargumentifitmatchesthegivenregularexpressionpattern.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 39: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/39.jpg)
SyntaxC#
publicstaticstringIsRegex(
stringregex
)
Parameters
regexType:System..::..StringThepatterntousetomatchthestringargumentvalue.
![Page 40: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/40.jpg)
Copy
ExamplesThefollowingexampleshowshowtoexpectacalltoamethodwherethestringargumentmatchesthegivenregularexpression:
C#
mock.Setup(x=>x.Check(It.IsRegex("[a-z]+"))).Returns(1);
![Page 41: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/41.jpg)
SeeAlsoItClassIsRegexOverloadMoqNamespace
![Page 42: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/42.jpg)
C#
MoqIt..::..IsRegexMethod(String,RegexOptions)ItClassExampleSeeAlsoSendFeedbackMatchesastringargumentifitmatchesthegivenregularexpressionpattern.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 43: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/43.jpg)
SyntaxC#
publicstaticstringIsRegex(
stringregex,
RegexOptionsoptions
)
Parameters
regexType:System..::..StringThepatterntousetomatchthestringargumentvalue.
optionsType:System.Text.RegularExpressions..::..RegexOptionsTheoptionsusedtointerpretthepattern.
![Page 44: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/44.jpg)
Copy
ExamplesThefollowingexampleshowshowtoexpectacalltoamethodwherethestringargumentmatchesthegivenregularexpression,inacaseinsensitiveway:
C#
mock.Setup(x=>x.Check(It.IsRegex("[a-z]+",RegexOptions.IgnoreCase))).Returns(
![Page 45: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/45.jpg)
SeeAlsoItClassIsRegexOverloadMoqNamespace
![Page 46: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/46.jpg)
C#
MoqMockClassMembersSeeAlsoSendFeedbackBaseclassformocksandstatichelperclasswithmethodsthatapplytomockedobjects,suchasGet<(Of<<'(T>)>>)(T)toretrieveaMock<(Of<(<'T>)>)>fromanobjectinstance.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 47: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/47.jpg)
SyntaxC#
publicabstractclassMock:IHideObjectMembers
![Page 48: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/48.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..MockMoq..::..Mock<(Of<(<'T>)>)>
![Page 50: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/50.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockMembersMockClassConstructorsMethodsPropertiesSeeAlsoSendFeedback
TheMocktypeexposesthefollowingmembers.
![Page 51: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/51.jpg)
Constructors Name Description
Mock InitializesanewinstanceoftheMockclass.
![Page 52: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/52.jpg)
Methods Name Description
As<(Of<<'(TInterface>)>>)Addsaninterfaceimplementationtothemock,allowingsetupstobespecifiedforit.
Get<(Of<<'(T>)>>) Retrievesthemockobjectforthegivenobjectinstance.
Of<(Of<<'(T>)>>)()()()() Createsanmockobjectoftheindicatedtype.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))OnGetObject Returnsthemockedobjectvalue.SetReturnsDefault<(Of<<'(TReturn>)>>)
Verify Verifiesthatallverifiableexpectationshavebeenmet.
VerifyAllVerifiesallexpectationsregardlessofwhethertheyhavebeenflaggedasverifiable.
![Page 53: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/53.jpg)
Properties Name Description
Behavior Behaviorofthemock,accordingtothevaluesetintheconstructor.
CallBaseWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).
DefaultValue Specifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.Object Getsthemockedobjectinstance.
![Page 55: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/55.jpg)
C#
MoqMockConstructorMockClassSeeAlsoSendFeedbackInitializesanewinstanceoftheMockclass.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 56: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/56.jpg)
SyntaxC#
protectedMock()
![Page 58: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/58.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockMethodsMockClassSeeAlsoSendFeedback
TheMocktypeexposesthefollowingmembers.
![Page 59: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/59.jpg)
Methods Name Description
As<(Of<<'(TInterface>)>>)Addsaninterfaceimplementationtothemock,allowingsetupstobespecifiedforit.
Get<(Of<<'(T>)>>) Retrievesthemockobjectforthegivenobjectinstance.
Of<(Of<<'(T>)>>)()()()() Createsanmockobjectoftheindicatedtype.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))OnGetObject Returnsthemockedobjectvalue.SetReturnsDefault<(Of<<'(TReturn>)>>)
Verify Verifiesthatallverifiableexpectationshavebeenmet.
VerifyAllVerifiesallexpectationsregardlessofwhethertheyhavebeenflaggedasverifiable.
![Page 61: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/61.jpg)
C#
MoqMock..::..As<(Of<(<'TInterface>)>)>MethodMockClassExampleSeeAlsoSendFeedbackAddsaninterfaceimplementationtothemock,allowingsetupstobespecifiedforit.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 62: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/62.jpg)
SyntaxC#
publicvirtualMock<TInterface>As<TInterface>()
whereTInterface:class
![Page 63: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/63.jpg)
TypeParametersTInterface
Typeofinterfacetocastthemockto.
![Page 64: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/64.jpg)
RemarksThismethodcanonlybecalledbeforethefirstuseofthemockObjectproperty,atwhichpointtheruntimetypehasalreadybeengeneratedandnomoreinterfacescanbeaddedtoit.
Also,TInterfacemustbeaninterfaceandnotaclass,whichmustbespecifiedwhencreatingthemockinstead.
![Page 65: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/65.jpg)
Copy
ExamplesThefollowingexamplecreatesamockforthemaininterfaceandlateraddsIDisposabletoittoverifyit'scalledbytheconsumercode:
C#
varmock=newMock<IProcessor>();
mock.Setup(x=>x.Execute("ping"));
//addIDisposableinterface
vardisposable=mock.As<IDisposable>();
disposable.Setup(d=>d.Dispose()).Verifiable();
![Page 66: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/66.jpg)
ExceptionsException Condition
System..::..InvalidOperationExceptionThemocktypehasalreadybeengeneratedbyaccessingtheObjectproperty.
System..::..ArgumentException TheTInterfacespecifiedisnotaninterface.
![Page 68: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/68.jpg)
C#
MoqMock..::..Get<(Of<(<'T>)>)>MethodMockClassExampleSeeAlsoSendFeedbackRetrievesthemockobjectforthegivenobjectinstance.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 69: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/69.jpg)
SyntaxC#
publicstaticMock<T>Get<T>(
Tmocked
)
whereT:class
Parameters
mockedType:TTheinstanceofthemockedobject.
![Page 70: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/70.jpg)
TypeParametersT
Typeofthemocktoretrieve.Canbeomittedasit'sinferredfromtheobjectinstancepassedinasthemockedinstance.
ReturnValue
Themockassociatedwiththemockedobject.
![Page 71: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/71.jpg)
Copy
ExamplesThefollowingexampleshowshowtoaddanewsetuptoanobjectinstancewhichisnottheoriginalMock<(Of<(<'T>)>)>butrathertheobjectassociatedwithit:
C#
//Typedinstance,notthemock,isretrievedfromsometestAPI.
HttpContextBasecontext=GetMockContext();
//context.Requestisthetypedobjectfromthe"real"API
//soinordertoaddasetuptoit,weneedtoget
//themockthat"owns"it
Mock<HttpRequestBase>request=Mock.Get(context.Request);
mock.Setup(req=>req.AppRelativeCurrentExecutionFilePath)
.Returns(tempUrl);
![Page 72: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/72.jpg)
ExceptionsException Condition
System..::..ArgumentException ThereceivedmockedinstancewasnotcreatedbyMoq.
![Page 74: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/74.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock..::..OfMethodMockClassSeeAlsoSendFeedback
![Page 75: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/75.jpg)
OverloadList Name Description
Of<(Of<<'(T>)>>)()()()() Createsanmockobjectoftheindicatedtype.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
![Page 76: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/76.jpg)
SeeAlsoMockClassMockMembersMoqNamespace
![Page 77: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/77.jpg)
C#
MoqMock..::..Of<(Of<(<'T>)>)>MethodMockClassSeeAlsoSendFeedbackCreatesanmockobjectoftheindicatedtype.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 78: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/78.jpg)
SyntaxC#
publicstaticTOf<T>()
whereT:class
![Page 79: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/79.jpg)
TypeParametersT
Thetypeofthemockedobject.
ReturnValue
Themockedobjectcreated.
![Page 80: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/80.jpg)
SeeAlsoMockClassOfOverloadMoqNamespace
![Page 81: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/81.jpg)
C#
MoqMock..::..Of<(Of<(<'T>)>)>Method(Expression<(Of<(<'Func>)>)>)MockClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock.Of``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 82: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/82.jpg)
SyntaxC#
publicstaticTOf<T>(
Expression<Func>predicate
)
whereT:class
Parameters
predicateType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 83: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/83.jpg)
TypeParametersT
![Page 84: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/84.jpg)
SeeAlsoMockClassOfOverloadMoqNamespace
![Page 85: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/85.jpg)
C#
MoqMock..::..OnGetObjectMethodMockClassSeeAlsoSendFeedbackReturnsthemockedobjectvalue.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 88: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/88.jpg)
C#
MoqMock..::..SetReturnsDefault<(Of<(<'TReturn>)>)>MethodMockClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock.SetReturnsDefault``1(``0)"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 89: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/89.jpg)
SyntaxC#
publicvoidSetReturnsDefault<TReturn>(
TReturnvalue
)
Parameters
valueType:TReturn
![Page 90: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/90.jpg)
TypeParametersTReturn
![Page 92: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/92.jpg)
C#
MoqMock..::..VerifyMethodMockClassExampleSeeAlsoSendFeedbackVerifiesthatallverifiableexpectationshavebeenmet.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 93: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/93.jpg)
SyntaxC#
publicvoidVerify()
![Page 94: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/94.jpg)
Copy
ExamplesThisexamplesetsupanexpectationandmarksitasverifiable.Afterthemockisused,aVerify()callisissuedonthemocktoensurethemethodinthesetupwasinvoked:
C#
varmock=newMock<IWarehouse>();
this.Setup(x=>x.HasInventory(TALISKER,50)).Verifiable().Returns(true
...
//othertestcode
...
//Willthrowifthetestcodehasdidn'tcallHasInventory.
this.Verify();
![Page 95: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/95.jpg)
ExceptionsException Condition
Moq..::..MockException Notallverifiableexpectationsweremet.
![Page 97: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/97.jpg)
C#
MoqMock..::..VerifyAllMethodMockClassExampleSeeAlsoSendFeedbackVerifiesallexpectationsregardlessofwhethertheyhavebeenflaggedasverifiable.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 98: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/98.jpg)
SyntaxC#
publicvoidVerifyAll()
![Page 99: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/99.jpg)
Copy
ExamplesThisexamplesetsupanexpectationwithoutmarkingitasverifiable.Afterthemockisused,aVerifyAll()()()()callisissuedonthemocktoensurethatallexpectationsaremet:
C#
varmock=newMock<IWarehouse>();
this.Setup(x=>x.HasInventory(TALISKER,50)).Returns(true);
...
//othertestcode
...
//Willthrowifthetestcodehasdidn'tcallHasInventory,even
//thatexpectationwasnotmarkedasverifiable.
this.VerifyAll();
![Page 100: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/100.jpg)
ExceptionsException Condition
Moq..::..MockException Atleastoneexpectationwasnotmet.
![Page 102: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/102.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockPropertiesMockClassSeeAlsoSendFeedback
TheMocktypeexposesthefollowingmembers.
![Page 103: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/103.jpg)
Properties Name Description
Behavior Behaviorofthemock,accordingtothevaluesetintheconstructor.
CallBaseWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).
DefaultValue Specifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.Object Getsthemockedobjectinstance.
![Page 105: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/105.jpg)
C#
MoqMock..::..BehaviorPropertyMockClassSeeAlsoSendFeedbackBehaviorofthemock,accordingtothevaluesetintheconstructor.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 106: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/106.jpg)
SyntaxC#
publicvirtualMockBehaviorBehavior{get;internalset;}
![Page 108: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/108.jpg)
C#
MoqMock..::..CallBasePropertyMockClassSeeAlsoSendFeedbackWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 111: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/111.jpg)
C#
MoqMock..::..DefaultValuePropertyMockClassSeeAlsoSendFeedbackSpecifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 112: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/112.jpg)
SyntaxC#
publicvirtualDefaultValueDefaultValue{get;set;}
![Page 114: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/114.jpg)
C#
MoqMock..::..ObjectPropertyMockClassSeeAlsoSendFeedbackGetsthemockedobjectinstance.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 117: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/117.jpg)
C#
MoqMock<(Of<(<'T>)>)>ClassMembersExampleSeeAlsoSendFeedbackProvidesamockimplementationofT.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 118: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/118.jpg)
SyntaxC#
publicclassMock<T>:Mock
whereT:class
![Page 119: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/119.jpg)
TypeParametersT
Typetomock,whichcanbeaninterfaceoraclass.
![Page 120: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/120.jpg)
RemarksAnyinterfacetypecanbeusedformocking,butforclasses,onlyabstractandvirtualmemberscanbemocked.
ThebehaviorofthemockwithregardstothesetupsandtheactualcallsisdeterminedbytheoptionalMockBehaviorthatcanbepassedtotheMock<(Of<(<'T>)>)>(MockBehavior)constructor.
![Page 121: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/121.jpg)
Copy
Copy
ExamplesThefollowingexampleshowsestablishingsetupswithspecificvaluesformethodinvocations:
C#
//Arrange
varorder=newOrder(TALISKER,50);
varmock=newMock<IWarehouse>();
mock.Setup(x=>x.HasInventory(TALISKER,50)).Returns(true);
//Act
order.Fill(mock.Object);
//Assert
Assert.True(order.IsFilled);
ThefollowingexampleshowshowtousetheItclasstospecifyconditionsforargumentsinsteadofspecificvalues:
C#
//Arrange
varorder=newOrder(TALISKER,50);
varmock=newMock<IWarehouse>();
//showshowtoexpectavaluewithinarange
mock.Setup(x=>x.HasInventory(
It.IsAny<string>(),
It.IsInRange(0,100,Range.Inclusive)))
.Returns(false);
//showshowtothrowforunexpectedcalls.
mock.Setup(x=>x.Remove(
It.IsAny<string>(),
It.IsAny<int>()))
.Throws(newInvalidOperationException());
//Act
order.Fill(mock.Object);
//Assert
![Page 122: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/122.jpg)
Assert.False(order.IsFilled);
![Page 123: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/123.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..MockMoq..::..Mock<(Of<(<'T>)>)>
![Page 124: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/124.jpg)
SeeAlsoMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 125: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/125.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>MembersMock<(Of<(<'T>)>)>ClassConstructorsMethodsPropertiesSeeAlsoSendFeedback
TheMock<(Of<(<'T>)>)>typeexposesthefollowingmembers.
![Page 126: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/126.jpg)
Constructors Name Description
Mock<(Of<(<'T>)>)>()()()() Initializesaninstanceofthemockwithdefaultbehavior.
Mock<(Of<(<'T>)>)>(array<Object>[]()[][])
Initializesaninstanceofthemockwithdefaultbehaviorandwiththegivenconstructorargumentsfortheclass.(OnlyvalidwhenTisaclass)
Mock<(Of<(<'T>)>)>(MockBehavior)
Initializesaninstanceofthemockwiththespecifiedbehavior.
Mock<(Of<(<'T>)>)>(MockBehavior,array<Object>[]()[][])
Initializesaninstanceofthemockwithaspecificbehaviorwiththegivenconstructorargumentsfortheclass.
![Page 127: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/127.jpg)
Methods Name Description
As<(Of<<'(TInterface>)>>)
Addsaninterfaceimplementationtothemock,allowingsetupstobespecifiedforit.(InheritedfromMock.)
OnGetObjectReturnsthemockedobjectvalue.(OverridesMock..::..OnGetObject()()()().)
Raise(Action<(Of<<'(T>)>>),EventArgs)
RaisestheeventreferencedineventExpressionusingthegivenargsargument.
Raise(Action<(Of<<'(T>)>>),array<Object>[]()[][])
RaisestheeventreferencedineventExpressionusingthegivenargsargumentforanon-EventHandlertypedevent.
SetReturnsDefault<(Of<<'(TReturn>)>>) (InheritedfromMock.)
Setup(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Specifiesasetuponthemockedtypeforacalltotoavoidmethod.
Setup<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
SetupAllProperties
Specifiesthattheallpropertiesonthemockshouldhave"propertybehavior",meaningthatsettingitsvaluewillcauseittobesavedandlaterreturnedwhenthepropertyisrequested.(thisisalsoknownas"stubbing").ThedefaultvalueforeachpropertywillbetheonegeneratedasspecifiedbytheDefaultValuepropertyforthemock.
![Page 128: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/128.jpg)
SetupGet<(Of<<'(TProperty>)>>)SetupProperty<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))SetupProperty<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
SetupSet(Action<(Of<<'(T>)>>))Specifiesasetuponthemockedtypeforacalltotoapropertysetter.
SetupSet<(Of<<'(TProperty>)>>)(Action<(Of<<'(T>)>>))
Specifiesasetuponthemockedtypeforacalltotoapropertysetter.
Verify()()()()Verifiesthatallverifiableexpectationshavebeenmet.(InheritedfromMock.)
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock.UseinconjuntionwiththedefaultLoose.
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>),Times)
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock.UseinconjuntionwiththedefaultLoose.
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>),String)
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock,specifyingafailureerrormessage.UseinconjuntionwiththedefaultLoose.
Verify(Expression<(Of
Verifiesthataspecificinvocationmatchingthegivenexpression
![Page 129: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/129.jpg)
<<'(Action<(Of<<'(T>)>>)>)>>),Times,String)
wasperformedonthemock,specifyingafailureerrormessage.UseinconjuntionwiththedefaultLoose.
Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
VerifyAll
Verifiesallexpectationsregardlessofwhethertheyhavebeenflaggedasverifiable.(InheritedfromMock.)
VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
VerifySet(Action<(Of<<'(T>)>>)) Verifiesthatapropertywassetonthemock.
VerifySet(Action<(Of<<'(T>)>>),Times)
Verifiesthatapropertywassetonthemock.
VerifySet(Action<(Of<<'(T>)>>),String)
Verifiesthatapropertywassetonthemock,specifyingafailuremessage.
Verifiesthatapropertywasseton
![Page 130: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/130.jpg)
VerifySet(Action<(Of<<'(T>)>>),Times,String)
themock,specifyingafailuremessage.
When
![Page 131: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/131.jpg)
ExtensionMethods Name Description
InSequence<(Of<<'(TMock>)>>)
Performanexpectationinthetrace.(DefinedbyMockSequenceHelper.)
Protected<(Of<<'(T>)>>)
Enableprotectedsetupsforthemock.(DefinedbyProtectedExtension.)
SetupSequence<(Of<<'(TMock,TResult>)>>) (DefinedbySequenceExtensions.)
SetupSet<(Of<<'(T,TProperty>)>>) (DefinedbyMockExtensions.)
VerifySet<(Of<<'(T,TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
Overloaded.(DefinedbyMockExtensions.)
VerifySet<(Of<<'(T,TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
Overloaded.(DefinedbyMockExtensions.)
VerifySet<(Of<<'(T,TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
Overloaded.(DefinedbyMockExtensions.)
VerifySet<(Of<<'(T,TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
Overloaded.(DefinedbyMockExtensions.)
![Page 132: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/132.jpg)
Properties Name Description
BehaviorBehaviorofthemock,accordingtothevaluesetintheconstructor.(InheritedfromMock.)
CallBase
Whetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).(InheritedfromMock.)
DefaultValueSpecifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.(InheritedfromMock.)
Object Exposesthemockedobjectinstance.
![Page 133: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/133.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace
![Page 134: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/134.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>ConstructorMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
![Page 135: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/135.jpg)
OverloadList Name Description
Mock<(Of<(<'T>)>)>()()()() Initializesaninstanceofthemockwithdefaultbehavior.
Mock<(Of<(<'T>)>)>(array<Object>[]()[][])
Initializesaninstanceofthemockwithdefaultbehaviorandwiththegivenconstructorargumentsfortheclass.(OnlyvalidwhenTisaclass)
Mock<(Of<(<'T>)>)>(MockBehavior)
Initializesaninstanceofthemockwiththespecifiedbehavior.
Mock<(Of<(<'T>)>)>(MockBehavior,array<Object>[]()[][])
Initializesaninstanceofthemockwithaspecificbehaviorwiththegivenconstructorargumentsfortheclass.
![Page 136: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/136.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 137: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/137.jpg)
C#
MoqMock<(Of<(<'T>)>)>ConstructorMock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackInitializesaninstanceofthemockwithdefaultbehavior.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 138: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/138.jpg)
SyntaxC#
publicMock()
![Page 139: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/139.jpg)
Copy
ExamplesC#
varmock=newMock<IFormatProvider>();
![Page 140: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/140.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>OverloadMoqNamespace
![Page 141: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/141.jpg)
C#
MoqMock<(Of<(<'T>)>)>Constructor(array<Object>[]()[][])Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackInitializesaninstanceofthemockwithdefaultbehaviorandwiththegivenconstructorargumentsfortheclass.(OnlyvalidwhenTisaclass)
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 142: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/142.jpg)
SyntaxC#
publicMock(
paramsObject[]args
)
Parameters
argsType:array<System..::..Object>[]()[][]Optionalconstructorargumentsifthemockedtypeisaclass.
![Page 143: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/143.jpg)
RemarksThemockwilltrytofindthebestmatchconstructorgiventheconstructorarguments,andinvokethattoinitializetheinstance.Thisappliesonlyforclasses,notinterfaces.
![Page 144: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/144.jpg)
Copy
ExamplesC#
varmock=newMock<MyProvider>(someArgument,25);
![Page 145: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/145.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>OverloadMoqNamespace
![Page 146: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/146.jpg)
C#
MoqMock<(Of<(<'T>)>)>Constructor(MockBehavior)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackInitializesaninstanceofthemockwiththespecifiedbehavior.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 147: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/147.jpg)
SyntaxC#
publicMock(
MockBehaviorbehavior
)
Parameters
behaviorType:Moq..::..MockBehaviorBehaviorofthemock.
![Page 148: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/148.jpg)
Copy
ExamplesC#
varmock=newMock<IFormatProvider>(MockBehavior.Relaxed);
![Page 149: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/149.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>OverloadMoqNamespace
![Page 150: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/150.jpg)
C#
MoqMock<(Of<(<'T>)>)>Constructor(MockBehavior,array<Object>[]()[][])Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackInitializesaninstanceofthemockwithaspecificbehaviorwiththegivenconstructorargumentsfortheclass.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 151: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/151.jpg)
SyntaxC#
publicMock(
MockBehaviorbehavior,
paramsObject[]args
)
Parameters
behaviorType:Moq..::..MockBehaviorBehaviorofthemock.
argsType:array<System..::..Object>[]()[][]Optionalconstructorargumentsifthemockedtypeisaclass.
![Page 152: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/152.jpg)
RemarksThemockwilltrytofindthebestmatchconstructorgiventheconstructorarguments,andinvokethattoinitializetheinstance.Thisappliesonlytoclasses,notinterfaces.
![Page 153: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/153.jpg)
Copy
ExamplesC#
varmock=newMock<MyProvider>(someArgument,25);
![Page 154: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/154.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>OverloadMoqNamespace
![Page 155: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/155.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>MethodsMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
TheMock<(Of<(<'T>)>)>typeexposesthefollowingmembers.
![Page 156: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/156.jpg)
Methods Name Description
As<(Of<<'(TInterface>)>>)
Addsaninterfaceimplementationtothemock,allowingsetupstobespecifiedforit.(InheritedfromMock.)
OnGetObjectReturnsthemockedobjectvalue.(OverridesMock..::..OnGetObject()()()().)
Raise(Action<(Of<<'(T>)>>),EventArgs)
RaisestheeventreferencedineventExpressionusingthegivenargsargument.
Raise(Action<(Of<<'(T>)>>),array<Object>[]()[][])
RaisestheeventreferencedineventExpressionusingthegivenargsargumentforanon-EventHandlertypedevent.
SetReturnsDefault<(Of<<'(TReturn>)>>) (InheritedfromMock.)
Setup(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Specifiesasetuponthemockedtypeforacalltotoavoidmethod.
Setup<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
SetupAllProperties
Specifiesthattheallpropertiesonthemockshouldhave"propertybehavior",meaningthatsettingitsvaluewillcauseittobesavedandlaterreturnedwhenthepropertyisrequested.(thisisalsoknownas"stubbing").ThedefaultvalueforeachpropertywillbetheonegeneratedasspecifiedbytheDefaultValuepropertyforthemock.
![Page 157: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/157.jpg)
SetupGet<(Of<<'(TProperty>)>>)SetupProperty<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))SetupProperty<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
SetupSet(Action<(Of<<'(T>)>>))Specifiesasetuponthemockedtypeforacalltotoapropertysetter.
SetupSet<(Of<<'(TProperty>)>>)(Action<(Of<<'(T>)>>))
Specifiesasetuponthemockedtypeforacalltotoapropertysetter.
Verify()()()()Verifiesthatallverifiableexpectationshavebeenmet.(InheritedfromMock.)
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock.UseinconjuntionwiththedefaultLoose.
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>),Times)
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock.UseinconjuntionwiththedefaultLoose.
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>),String)
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock,specifyingafailureerrormessage.UseinconjuntionwiththedefaultLoose.
Verify(Expression<(Of
Verifiesthataspecificinvocationmatchingthegivenexpression
![Page 158: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/158.jpg)
<<'(Action<(Of<<'(T>)>>)>)>>),Times,String)
wasperformedonthemock,specifyingafailureerrormessage.UseinconjuntionwiththedefaultLoose.
Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
VerifyAll
Verifiesallexpectationsregardlessofwhethertheyhavebeenflaggedasverifiable.(InheritedfromMock.)
VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
VerifySet(Action<(Of<<'(T>)>>)) Verifiesthatapropertywassetonthemock.
VerifySet(Action<(Of<<'(T>)>>),Times)
Verifiesthatapropertywassetonthemock.
VerifySet(Action<(Of<<'(T>)>>),String)
Verifiesthatapropertywassetonthemock,specifyingafailuremessage.
Verifiesthatapropertywasseton
![Page 159: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/159.jpg)
VerifySet(Action<(Of<<'(T>)>>),Times,String)
themock,specifyingafailuremessage.
When
![Page 160: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/160.jpg)
ExtensionMethods Name Description
InSequence<(Of<<'(TMock>)>>)
Performanexpectationinthetrace.(DefinedbyMockSequenceHelper.)
Protected<(Of<<'(T>)>>)
Enableprotectedsetupsforthemock.(DefinedbyProtectedExtension.)
SetupSequence<(Of<<'(TMock,TResult>)>>) (DefinedbySequenceExtensions.)
SetupSet<(Of<<'(T,TProperty>)>>) (DefinedbyMockExtensions.)
VerifySet<(Of<<'(T,TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
Overloaded.(DefinedbyMockExtensions.)
VerifySet<(Of<<'(T,TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
Overloaded.(DefinedbyMockExtensions.)
VerifySet<(Of<<'(T,TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
Overloaded.(DefinedbyMockExtensions.)
VerifySet<(Of<<'(T,TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
Overloaded.(DefinedbyMockExtensions.)
![Page 161: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/161.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace
![Page 162: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/162.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..OnGetObjectMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedbackReturnsthemockedobjectvalue.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 164: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/164.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace
![Page 165: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/165.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>..::..RaiseMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
![Page 166: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/166.jpg)
OverloadList Name Description
Raise(Action<(Of<<'(T>)>>),EventArgs)
RaisestheeventreferencedineventExpressionusingthegivenargsargument.
Raise(Action<(Of<<'(T>)>>),array<Object>[]()[][])
RaisestheeventreferencedineventExpressionusingthegivenargsargumentforanon-EventHandlertypedevent.
![Page 167: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/167.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 168: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/168.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..RaiseMethod(Action<(Of<(<'T>)>)>,EventArgs)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackRaisestheeventreferencedineventExpressionusingthegivenargsargument.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 169: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/169.jpg)
SyntaxC#
publicvoidRaise(
Action<T>eventExpression,
EventArgsargs
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
argsType:System..::..EventArgs
![Page 170: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/170.jpg)
Copy
ExamplesThefollowingexampleshowshowtoraiseaPropertyChangedevent:
C#
varmock=newMock<IViewModel>();
mock.Raise(x=>x.PropertyChanged-=null,newPropertyChangedEventArgs(
![Page 171: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/171.jpg)
Copy
ExamplesThisexampleshowshowtoinvokeaneventwithacustomeventargumentsclassinaviewthatwillcauseitscorrespondingpresentertoreactbychangingitsstate:
C#
varmockView=newMock<IOrdersView>();
varpresenter=newOrdersPresenter(mockView.Object);
//Checkthatthepresenterhasnoselectionbydefault
Assert.Null(presenter.SelectedOrder);
//Raisetheeventwithaspecificargumentsdata
mockView.Raise(v=>v.SelectionChanged+=null,newOrderEventArgs{Order=
//Nowthepresenterreactedtotheevent,andwehaveaselectedorder
Assert.NotNull(presenter.SelectedOrder);
Assert.Equal("moq",presenter.SelectedOrder.ProductName);
![Page 172: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/172.jpg)
ExceptionsException Condition
System..::..ArgumentExceptionTheargsargumentisinvalidforthetargeteventinvocation,ortheeventExpressionisnotaneventattachordetachexpression.
![Page 173: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/173.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassRaiseOverloadMoqNamespace
![Page 174: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/174.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..RaiseMethod(Action<(Of<(<'T>)>)>,array<Object>[]()[][])Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackRaisestheeventreferencedineventExpressionusingthegivenargsargumentforanon-EventHandlertypedevent.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 175: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/175.jpg)
SyntaxC#
publicvoidRaise(
Action<T>eventExpression,
paramsObject[]args
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
argsType:array<System..::..Object>[]()[][]
![Page 176: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/176.jpg)
Copy
ExamplesThefollowingexampleshowshowtoraiseacustomeventthatdoesnotadheretothestandardEventHandler:
C#
varmock=newMock<IViewModel>();
mock.Raise(x=>x.MyEvent-=null,"Name",bool,25);
![Page 177: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/177.jpg)
ExceptionsException Condition
System..::..ArgumentExceptionTheargsargumentsareinvalidforthetargeteventinvocation,ortheeventExpressionisnotaneventattachordetachexpression.
![Page 178: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/178.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassRaiseOverloadMoqNamespace
![Page 179: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/179.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>..::..SetupMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
![Page 180: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/180.jpg)
OverloadList Name Description
Setup(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Specifiesasetuponthemockedtypeforacalltotoavoidmethod.
Setup<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
![Page 181: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/181.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 182: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/182.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..SetupMethod(Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackSpecifiesasetuponthemockedtypeforacalltotoavoidmethod.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 183: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/183.jpg)
SyntaxC#
publicISetup<T>Setup(
Expression<Action<T>>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>Lambdaexpressionthatspecifiestheexpectedmethodinvocation.
![Page 184: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/184.jpg)
RemarksIfmorethanonesetupisspecifiedforthesamemethodorproperty,thelatestonewinsandistheonethatwillbeexecuted.
![Page 185: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/185.jpg)
Copy
ExamplesC#
varmock=newMock<IProcessor>();
mock.Setup(x=>x.Execute("ping"));
![Page 186: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/186.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassSetupOverloadMoqNamespace
![Page 187: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/187.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..Setup<(Of<(<'TResult>)>)>Method(Expression<(Of<(<'Func>)>)>)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.Setup``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 188: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/188.jpg)
SyntaxC#
publicISetup<T,TResult>Setup<TResult>(
Expression<Func>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 189: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/189.jpg)
TypeParametersTResult
![Page 190: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/190.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassSetupOverloadMoqNamespace
![Page 191: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/191.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..SetupAllPropertiesMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedbackSpecifiesthattheallpropertiesonthemockshouldhave"propertybehavior",meaningthatsettingitsvaluewillcauseittobesavedandlaterreturnedwhenthepropertyisrequested.(thisisalsoknownas"stubbing").ThedefaultvalueforeachpropertywillbetheonegeneratedasspecifiedbytheDefaultValuepropertyforthemock.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 192: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/192.jpg)
SyntaxC#
publicMock<T>SetupAllProperties()
![Page 193: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/193.jpg)
RemarksIfthemockDefaultValueissettoMock,themockeddefaultvalueswillalsogetallpropertiessetuprecursively.
![Page 194: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/194.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace
![Page 195: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/195.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..SetupGet<(Of<(<'TProperty>)>)>MethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.SetupGet``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 196: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/196.jpg)
SyntaxC#
publicISetupGetter<T,TProperty>SetupGet<TProperty>(
Expression<Func>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 197: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/197.jpg)
TypeParametersTProperty
![Page 198: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/198.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace
![Page 199: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/199.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>..::..SetupPropertyMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
![Page 200: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/200.jpg)
OverloadList Name Description
SetupProperty<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))SetupProperty<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
![Page 201: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/201.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 202: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/202.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..SetupProperty<(Of<(<'TProperty>)>)>Method(Expression<(Of<(<'Func>)>)>)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.SetupProperty``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 203: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/203.jpg)
SyntaxC#
publicMock<T>SetupProperty<TProperty>(
Expression<Func>property
)
Parameters
propertyType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 204: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/204.jpg)
TypeParametersTProperty
![Page 205: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/205.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassSetupPropertyOverloadMoqNamespace
![Page 206: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/206.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..SetupProperty<(Of<(<'TProperty>)>)>Method(Expression<(Of<(<'Func>)>)>,Boolean)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.SetupProperty``1(System.Linq.Expressions.Expression{System.Func`2},System.Boolean)"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 207: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/207.jpg)
SyntaxC#
publicMock<T>SetupProperty<TProperty>(
Expression<Func>property,
boolinitialValue
)
Parameters
propertyType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
initialValueType:System..::..Boolean
![Page 208: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/208.jpg)
TypeParametersTProperty
![Page 209: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/209.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassSetupPropertyOverloadMoqNamespace
![Page 210: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/210.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>..::..SetupSetMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
![Page 211: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/211.jpg)
OverloadList Name Description
SetupSet<(Of<<'(TProperty>)>>)(Action<(Of<<'(T>)>>))
Specifiesasetuponthemockedtypeforacalltotoapropertysetter.
SetupSet(Action<(Of<<'(T>)>>))
Specifiesasetuponthemockedtypeforacalltotoapropertysetter.
![Page 212: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/212.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 213: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/213.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..SetupSet<(Of<(<'TProperty>)>)>Method(Action<(Of<(<'T>)>)>)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackSpecifiesasetuponthemockedtypeforacalltotoapropertysetter.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 214: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/214.jpg)
SyntaxC#
publicISetupSetter<T,TProperty>SetupSet<TProperty>(
Action<T>setterExpression
)
Parameters
setterExpressionType:System..::..Action<(Of<(<'T>)>)>TheLambdaexpressionthatsetsapropertytoavalue.
![Page 215: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/215.jpg)
TypeParametersTProperty
Typeoftheproperty.Typicallyomittedasitcanbeinferredfromtheexpression.
![Page 216: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/216.jpg)
RemarksIfmorethanonesetupissetforthesamepropertysetter,thelatestonewinsandistheonethatwillbeexecuted.
Thisoverloadsallowstheuseofacallbackalreadytypedforthepropertytype.
![Page 217: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/217.jpg)
Copy
ExamplesC#
mock.SetupSet(x=>x.Suspended=true);
![Page 218: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/218.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassSetupSetOverloadMoqNamespace
![Page 219: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/219.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..SetupSetMethod(Action<(Of<(<'T>)>)>)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackSpecifiesasetuponthemockedtypeforacalltotoapropertysetter.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 220: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/220.jpg)
SyntaxC#
publicISetup<T>SetupSet(
Action<T>setterExpression
)
Parameters
setterExpressionType:System..::..Action<(Of<(<'T>)>)>Lambdaexpressionthatsetsapropertytoavalue.
![Page 221: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/221.jpg)
RemarksIfmorethanonesetupissetforthesamepropertysetter,thelatestonewinsandistheonethatwillbeexecuted.
![Page 222: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/222.jpg)
Copy
ExamplesC#
mock.SetupSet(x=>x.Suspended=true);
![Page 223: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/223.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassSetupSetOverloadMoqNamespace
![Page 224: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/224.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>..::..VerifyMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
![Page 225: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/225.jpg)
OverloadList Name Description
Verify()()()()Verifiesthatallverifiableexpectationshavebeenmet.(InheritedfromMock.)
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock.UseinconjuntionwiththedefaultLoose.
Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>),Times)
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock.UseinconjuntionwiththedefaultLoose.
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>),String)
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock,specifyingafailureerrormessage.UseinconjuntionwiththedefaultLoose.
Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
Verify(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>),Times,String)
Verifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock,specifyingafailureerrormessage.UseinconjuntionwiththedefaultLoose.
![Page 226: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/226.jpg)
Verify<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
![Page 227: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/227.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 228: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/228.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifyMethod(Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackVerifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock.UseinconjuntionwiththedefaultLoose.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 229: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/229.jpg)
SyntaxC#
publicvoidVerify(
Expression<Action<T>>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>Expressiontoverify.
![Page 230: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/230.jpg)
Copy
ExamplesThisexampleassumesthatthemockhasbeenused,andlaterwewanttoverifythatagiveninvocationwithspecificparameterswasperformed:
C#
varmock=newMock<IProcessor>();
//exercisemock
//...
//Willthrowifthetestcodedidn'tcallExecutewitha"ping"stringargument.
mock.Verify(proc=>proc.Execute("ping"));
![Page 231: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/231.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotperformedonthemock.
![Page 232: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/232.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace
![Page 233: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/233.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..Verify<(Of<(<'TResult>)>)>Method(Expression<(Of<(<'Func>)>)>)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.Verify``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 234: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/234.jpg)
SyntaxC#
publicvoidVerify<TResult>(
Expression<Func>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 235: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/235.jpg)
TypeParametersTResult
![Page 236: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/236.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace
![Page 237: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/237.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifyMethod(Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>,Times)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedbackVerifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock.UseinconjuntionwiththedefaultLoose.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 238: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/238.jpg)
SyntaxC#
publicvoidVerify(
Expression<Action<T>>expression,
Timestimes
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>Expressiontoverify.
timesType:Moq..::..TimesThenumberoftimesamethodisallowedtobecalled.
![Page 239: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/239.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotcallthetimesspecifiedbytimes.
![Page 240: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/240.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace
![Page 241: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/241.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifyMethod(Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>,String)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackVerifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock,specifyingafailureerrormessage.UseinconjuntionwiththedefaultLoose.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 242: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/242.jpg)
SyntaxC#
publicvoidVerify(
Expression<Action<T>>expression,
stringfailMessage
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>Expressiontoverify.
failMessageType:System..::..StringMessagetoshowifverificationfails.
![Page 243: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/243.jpg)
Copy
ExamplesThisexampleassumesthatthemockhasbeenused,andlaterwewanttoverifythatagiveninvocationwithspecificparameterswasperformed:
C#
varmock=newMock<IProcessor>();
//exercisemock
//...
//Willthrowifthetestcodedidn'tcallExecutewitha"ping"stringargument.
mock.Verify(proc=>proc.Execute("ping"));
![Page 244: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/244.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotperformedonthemock.
![Page 245: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/245.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace
![Page 246: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/246.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..Verify<(Of<(<'TResult>)>)>Method(Expression<(Of<(<'Func>)>)>,Boolean)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.Verify``1(System.Linq.Expressions.Expression{System.Func`2},System.Boolean)"]
Namespace:MoqAssemblies:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 247: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/247.jpg)
SyntaxC#
publicvoidVerify<TResult>(
Expression<Func>expression,
booltimes
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
timesType:System..::..Boolean
![Page 248: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/248.jpg)
TypeParametersTResult
![Page 249: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/249.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace
![Page 250: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/250.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifyMethod(Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>,Times,String)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedbackVerifiesthataspecificinvocationmatchingthegivenexpressionwasperformedonthemock,specifyingafailureerrormessage.UseinconjuntionwiththedefaultLoose.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 251: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/251.jpg)
SyntaxC#
publicvoidVerify(
Expression<Action<T>>expression,
Timestimes,
stringfailMessage
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>Expressiontoverify.
timesType:Moq..::..TimesThenumberoftimesamethodisallowedtobecalled.
failMessageType:System..::..StringMessagetoshowifverificationfails.
![Page 252: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/252.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotcallthetimesspecifiedbytimes.
![Page 253: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/253.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace
![Page 254: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/254.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..Verify<(Of<(<'TResult>)>)>Method(Expression<(Of<(<'Func>)>)>,Boolean,T)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.Verify``1(System.Linq.Expressions.Expression{System.Func`2},System.Boolean,`0)"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 255: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/255.jpg)
SyntaxC#
publicvoidVerify<TResult>(
Expression<Func>expression,
booltimes,
TfailMessage
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
timesType:System..::..Boolean
failMessageType:T
![Page 256: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/256.jpg)
TypeParametersTResult
![Page 257: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/257.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace
![Page 258: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/258.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>..::..VerifyGetMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
![Page 259: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/259.jpg)
OverloadList Name Description
VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)VerifyGet<(Of<<'(TProperty>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
![Page 260: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/260.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 261: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/261.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifyGet<(Of<(<'TProperty>)>)>Method(Expression<(Of<(<'Func>)>)>)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.VerifyGet``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 262: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/262.jpg)
SyntaxC#
publicvoidVerifyGet<TProperty>(
Expression<Func>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 263: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/263.jpg)
TypeParametersTProperty
![Page 264: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/264.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyGetOverloadMoqNamespace
![Page 265: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/265.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifyGet<(Of<(<'TProperty>)>)>Method(Expression<(Of<(<'Func>)>)>,Boolean)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.VerifyGet``1(System.Linq.Expressions.Expression{System.Func`2},System.Boolean)"]
Namespace:MoqAssemblies:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 266: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/266.jpg)
SyntaxC#
publicvoidVerifyGet<TProperty>(
Expression<Func>expression,
boolfailMessage
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
failMessageType:System..::..Boolean
![Page 267: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/267.jpg)
TypeParametersTProperty
![Page 268: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/268.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyGetOverloadMoqNamespace
![Page 269: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/269.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifyGet<(Of<(<'TProperty>)>)>Method(Expression<(Of<(<'Func>)>)>,Boolean,T)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.VerifyGet``1(System.Linq.Expressions.Expression{System.Func`2},System.Boolean,`0)"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 270: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/270.jpg)
SyntaxC#
publicvoidVerifyGet<TProperty>(
Expression<Func>expression,
booltimes,
TfailMessage
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
timesType:System..::..Boolean
failMessageType:T
![Page 271: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/271.jpg)
TypeParametersTProperty
![Page 272: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/272.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyGetOverloadMoqNamespace
![Page 273: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/273.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>..::..VerifySetMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
![Page 274: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/274.jpg)
OverloadList Name Description
VerifySet(Action<(Of<<'(T>)>>))
Verifiesthatapropertywassetonthemock.
VerifySet(Action<(Of<<'(T>)>>),Times)
Verifiesthatapropertywassetonthemock.
VerifySet(Action<(Of<<'(T>)>>),String)
Verifiesthatapropertywassetonthemock,specifyingafailuremessage.
VerifySet(Action<(Of<<'(T>)>>),Times,String)
Verifiesthatapropertywassetonthemock,specifyingafailuremessage.
![Page 275: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/275.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace
![Page 276: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/276.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifySetMethod(Action<(Of<(<'T>)>)>)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackVerifiesthatapropertywassetonthemock.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 277: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/277.jpg)
SyntaxC#
publicvoidVerifySet(
Action<T>setterExpression
)
Parameters
setterExpressionType:System..::..Action<(Of<(<'T>)>)>Expressiontoverify.
![Page 278: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/278.jpg)
Copy
ExamplesThisexampleassumesthatthemockhasbeenused,andlaterwewanttoverifythatagivenpropertywassetonit:
C#
varmock=newMock<IWarehouse>();
//exercisemock
//...
//Willthrowifthetestcodedidn'tsettheIsClosedproperty.
mock.VerifySet(warehouse=>warehouse.IsClosed=true);
![Page 279: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/279.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotperformedonthemock.
![Page 280: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/280.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifySetOverloadMoqNamespace
![Page 281: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/281.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifySetMethod(Action<(Of<(<'T>)>)>,Times)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedbackVerifiesthatapropertywassetonthemock.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 282: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/282.jpg)
SyntaxC#
publicvoidVerifySet(
Action<T>setterExpression,
Timestimes
)
Parameters
setterExpressionType:System..::..Action<(Of<(<'T>)>)>Expressiontoverify.
timesType:Moq..::..TimesThenumberoftimesamethodisallowedtobecalled.
![Page 283: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/283.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotcallthetimesspecifiedbytimes.
![Page 284: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/284.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifySetOverloadMoqNamespace
![Page 285: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/285.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifySetMethod(Action<(Of<(<'T>)>)>,String)Mock<(Of<(<'T>)>)>ClassExampleSeeAlsoSendFeedbackVerifiesthatapropertywassetonthemock,specifyingafailuremessage.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 286: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/286.jpg)
SyntaxC#
publicvoidVerifySet(
Action<T>setterExpression,
stringfailMessage
)
Parameters
setterExpressionType:System..::..Action<(Of<(<'T>)>)>Expressiontoverify.
failMessageType:System..::..StringMessagetoshowifverificationfails.
![Page 287: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/287.jpg)
Copy
ExamplesThisexampleassumesthatthemockhasbeenused,andlaterwewanttoverifythatagivenpropertywassetonit:
C#
varmock=newMock<IWarehouse>();
//exercisemock
//...
//Willthrowifthetestcodedidn'tsettheIsClosedproperty.
mock.VerifySet(warehouse=>warehouse.IsClosed=true,"Warehouseshouldalwaysbeclosedaftertheaction"
![Page 288: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/288.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotperformedonthemock.
![Page 289: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/289.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifySetOverloadMoqNamespace
![Page 290: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/290.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..VerifySetMethod(Action<(Of<(<'T>)>)>,Times,String)Mock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedbackVerifiesthatapropertywassetonthemock,specifyingafailuremessage.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 291: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/291.jpg)
SyntaxC#
publicvoidVerifySet(
Action<T>setterExpression,
Timestimes,
stringfailMessage
)
Parameters
setterExpressionType:System..::..Action<(Of<(<'T>)>)>Expressiontoverify.
timesType:Moq..::..TimesThenumberoftimesamethodisallowedtobecalled.
failMessageType:System..::..StringMessagetoshowifverificationfails.
![Page 292: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/292.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotcallthetimesspecifiedbytimes.
![Page 293: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/293.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassVerifySetOverloadMoqNamespace
![Page 294: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/294.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..WhenMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mock`1.When(System.Func`1)"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 295: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/295.jpg)
SyntaxC#
publicISetupConditionResult<T>When(
Funccondition
)
Parameters
conditionType:System..::..Func<(Of<(<'TResult>)>)>
![Page 296: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/296.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace
![Page 297: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/297.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMock<(Of<(<'T>)>)>PropertiesMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedback
TheMock<(Of<(<'T>)>)>typeexposesthefollowingmembers.
![Page 298: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/298.jpg)
Properties Name Description
BehaviorBehaviorofthemock,accordingtothevaluesetintheconstructor.(InheritedfromMock.)
CallBase
Whetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).(InheritedfromMock.)
DefaultValueSpecifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.(InheritedfromMock.)
Object Exposesthemockedobjectinstance.
![Page 299: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/299.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace
![Page 300: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/300.jpg)
C#
MoqMock<(Of<(<'T>)>)>..::..ObjectPropertyMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedbackExposesthemockedobjectinstance.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 301: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/301.jpg)
SyntaxC#
publicvirtualTObject{get;}
![Page 302: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/302.jpg)
SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace
![Page 303: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/303.jpg)
C#
MoqMockBehaviorEnumerationSeeAlsoSendFeedbackOptionstocustomizethebehaviorofthemock.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 304: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/304.jpg)
SyntaxC#
publicenumMockBehavior
![Page 305: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/305.jpg)
MembersMembername DescriptionStrictLooseDefault
![Page 307: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/307.jpg)
C#
MoqMockExceptionClassMembersSeeAlsoSendFeedbackExceptionthrownbymockswhensetupsarenotmatched,themockisnotproperlysetup,etc.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 308: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/308.jpg)
SyntaxC#
[SerializableAttribute]
publicclassMockException:Exception
![Page 309: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/309.jpg)
RemarksAdistinctexceptiontypeisprovidedsothatexceptionsthrownbythemockcanbedifferentiatedinteststhatexpectotherexceptionstobethrown(i.e.ArgumentException).
Richerexceptionhierarchy/typesarenotprovidedasteststypicallyshouldnotcatchorexpectexceptionsfromthemocks.Thesearetypicallytheresultofchangesinthetestedclassoritscollaboratorsimplementation,andresultinfixesinthemocksetupsothattheydissapearandallowthetesttopass.
![Page 310: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/310.jpg)
InheritanceHierarchySystem..::..ObjectSystem..::..ExceptionMoq..::..MockException
![Page 311: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/311.jpg)
SeeAlsoMockExceptionMembersMoqNamespace
![Page 312: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/312.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockExceptionMembersMockExceptionClassConstructorsMethodsSeeAlsoSendFeedback
TheMockExceptiontypeexposesthefollowingmembers.
![Page 313: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/313.jpg)
Constructors Name Description
MockException Supportstheserializationinfrastructure.
![Page 314: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/314.jpg)
Methods Name Description
GetObjectData
Supportstheserializationinfrastructure.(OverridesException..::..GetObjectData(SerializationInfo,StreamingContext).)
![Page 315: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/315.jpg)
SeeAlsoMockExceptionClassMoqNamespace
![Page 316: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/316.jpg)
C#
MoqMockExceptionConstructorMockExceptionClassSeeAlsoSendFeedbackSupportstheserializationinfrastructure.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 317: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/317.jpg)
SyntaxC#
protectedMockException(
SerializationInfoinfo,
StreamingContextcontext
)
Parameters
infoType:System.Runtime.Serialization..::..SerializationInfoSerializationinformation.
contextType:System.Runtime.Serialization..::..StreamingContextStreamingcontext.
![Page 318: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/318.jpg)
SeeAlsoMockExceptionClassMoqNamespace
![Page 319: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/319.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockExceptionMethodsMockExceptionClassSeeAlsoSendFeedback
TheMockExceptiontypeexposesthefollowingmembers.
![Page 320: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/320.jpg)
Methods Name Description
GetObjectData
Supportstheserializationinfrastructure.(OverridesException..::..GetObjectData(SerializationInfo,StreamingContext).)
![Page 321: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/321.jpg)
SeeAlsoMockExceptionClassMoqNamespace
![Page 322: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/322.jpg)
C#
MoqMockException..::..GetObjectDataMethodMockExceptionClassSeeAlsoSendFeedbackSupportstheserializationinfrastructure.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 323: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/323.jpg)
SyntaxC#
publicoverridevoidGetObjectData(
SerializationInfoinfo,
StreamingContextcontext
)
Parameters
infoType:System.Runtime.Serialization..::..SerializationInfoSerializationinformation.
contextType:System.Runtime.Serialization..::..StreamingContextStreamingcontext.
Implements
ISerializable..::..GetObjectData(SerializationInfo,StreamingContext)_Exception..::..GetObjectData(SerializationInfo,StreamingContext)
![Page 324: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/324.jpg)
SeeAlsoMockExceptionClassMoqNamespace
![Page 325: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/325.jpg)
C#
MoqMockExtensionsClassMembersSeeAlsoSendFeedbackProvidesadditionalmethodsonmocks.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 326: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/326.jpg)
SyntaxC#
publicstaticclassMockExtensions
![Page 327: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/327.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..MockExtensions
![Page 328: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/328.jpg)
SeeAlsoMockExtensionsMembersMoqNamespace
![Page 329: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/329.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockExtensionsMembersMockExtensionsClassMethodsSeeAlsoSendFeedback
TheMockExtensionstypeexposesthefollowingmembers.
![Page 330: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/330.jpg)
Methods Name Description
SetupSet<(Of<<'(T,TProperty>)>>) Obsolete.VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
Obsolete.
VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
Obsolete.
VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
Obsolete.
![Page 331: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/331.jpg)
SeeAlsoMockExtensionsClassMoqNamespace
![Page 332: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/332.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockExtensionsMethodsMockExtensionsClassSeeAlsoSendFeedback
TheMockExtensionstypeexposesthefollowingmembers.
![Page 333: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/333.jpg)
Methods Name Description
SetupSet<(Of<<'(T,TProperty>)>>) Obsolete.VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
Obsolete.
VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
Obsolete.
VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
Obsolete.
![Page 334: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/334.jpg)
SeeAlsoMockExtensionsClassMoqNamespace
![Page 335: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/335.jpg)
C#
MoqMockExtensions..::..SetupSet<(Of<(<'T,TProperty>)>)>MethodMockExtensionsClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.MockExtensions.SetupSet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 336: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/336.jpg)
SyntaxC#
[ObsoleteAttribute("ReplacedbySetupSet(Action)")]
publicstaticISetupSetter<T,TProperty>SetupSet<T,TProperty>(
thisMock<T>mock,
Expression<Func>expression
)
whereT:class
Parameters
mockType:Moq..::..Mock<(Of<(<'T>)>)>
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 337: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/337.jpg)
TypeParametersTTProperty
![Page 338: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/338.jpg)
SeeAlsoMockExtensionsClassMoqNamespace
![Page 339: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/339.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockExtensions..::..VerifySetMethodMockExtensionsClassSeeAlsoSendFeedback
![Page 340: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/340.jpg)
OverloadList Name Description
VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
Obsolete.
VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)
Obsolete.
VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean)VerifySet<(Of<<'(T,TProperty>)>>)(Mock<(Of<<'(T>)>>),Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>),Boolean,T)
Obsolete.
![Page 341: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/341.jpg)
SeeAlsoMockExtensionsClassMockExtensionsMembersMoqNamespace
![Page 342: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/342.jpg)
C#
MoqMockExtensions..::..VerifySet<(Of<(<'T,TProperty>)>)>Method(Mock<(Of<(<'T>)>)>,Expression<(Of<(<'Func>)>)>)MockExtensionsClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.MockExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 343: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/343.jpg)
SyntaxC#
[ObsoleteAttribute("ReplacedbyVerifySet(Action)")]
publicstaticvoidVerifySet<T,TProperty>(
thisMock<T>mock,
Expression<Func>expression
)
whereT:class
Parameters
mockType:Moq..::..Mock<(Of<(<'T>)>)>
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 344: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/344.jpg)
TypeParametersTTProperty
![Page 345: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/345.jpg)
SeeAlsoMockExtensionsClassVerifySetOverloadMoqNamespace
![Page 346: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/346.jpg)
C#
MoqMockExtensions..::..VerifySet<(Of<(<'T,TProperty>)>)>Method(Mock<(Of<(<'T>)>)>,Expression<(Of<(<'Func>)>)>,Boolean)MockExtensionsClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.MockExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func`2},System.Boolean)"]
Namespace:MoqAssemblies:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 347: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/347.jpg)
SyntaxC#
[ObsoleteAttribute("ReplacedbyVerifySet(Action,Times)")]
publicstaticvoidVerifySet<T,TProperty>(
thisMock<T>mock,
Expression<Func>expression,
booltimes
)
whereT:class
Parameters
mockType:Moq..::..Mock<(Of<(<'T>)>)>
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
timesType:System..::..Boolean
![Page 348: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/348.jpg)
TypeParametersTTProperty
![Page 349: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/349.jpg)
SeeAlsoMockExtensionsClassVerifySetOverloadMoqNamespace
![Page 350: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/350.jpg)
C#
MoqMockExtensions..::..VerifySet<(Of<(<'T,TProperty>)>)>Method(Mock<(Of<(<'T>)>)>,Expression<(Of<(<'Func>)>)>,Boolean,T)MockExtensionsClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.MockExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func`2},System.Boolean,``0)"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 351: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/351.jpg)
SyntaxC#
[ObsoleteAttribute("ReplacedbyVerifySet(Action,Times,string)")]
publicstaticvoidVerifySet<T,TProperty>(
thisMock<T>mock,
Expression<Func>expression,
booltimes,
TfailMessage
)
whereT:class
Parameters
mockType:Moq..::..Mock<(Of<(<'T>)>)>
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
timesType:System..::..Boolean
failMessageType:T
![Page 352: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/352.jpg)
TypeParametersTTProperty
![Page 353: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/353.jpg)
SeeAlsoMockExtensionsClassVerifySetOverloadMoqNamespace
![Page 354: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/354.jpg)
C#
MoqMockFactoryClassMembersExampleSeeAlsoSendFeedbackUtilityfactoryclasstousetoconstructmultiplemockswhenconsistentverificationisdesiredforallofthem.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 355: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/355.jpg)
SyntaxC#
[ObsoleteAttribute("ThisclasshasbeenrenamedtoMockRepository.MockFactorywillberetiredinv5.",
false)]
publicclassMockFactory
![Page 356: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/356.jpg)
RemarksIfmultiplemockswillbecreatedduringatest,passingthedesiredMockBehavior(ifdifferentthantheDefaultortheonepassedtothefactoryconstructor)andlaterverifyingeachmockcanbecomerepetitiveandtedious.
ThisfactoryclasshelpsinthatscenariobyprovidingasimplifiedcreationofmultiplemockswithadefaultMockBehavior(unlessoverridenbycallingCreate<(Of<<'(T>)>>)(MockBehavior))andposteriorverification.
![Page 357: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/357.jpg)
Copy
Copy
ExamplesThefollowingisastraightforwardexampleonhowtocreateandautomaticallyverifystrictmocksusingaMockFactory:
C#
varfactory=newMockFactory(MockBehavior.Strict);
varfoo=factory.Create<IFoo>();
varbar=factory.Create<IBar>();
//noneedtocallVerifiable()onthesetup
//aswe'llbevalidatingallofthemanyway.
foo.Setup(f=>f.Do());
bar.Setup(b=>b.Redo());
//exercisethemockshere
factory.VerifyAll();
//Atthispointallsetupsarealreadychecked
//andanoptionalMockExceptionmightbethrown.
//Notealsothatbecausethemocksarestrict,anyinvocation
//thatdoesn'thaveamatchingsetupwillalsothrowaMockException.
Thefollowingexamplesshowshowtosetupthefactorytocreateloosemocksandlaterverifyonlyverifiablesetups:
C#
varfactory=newMockFactory(MockBehavior.Loose);
varfoo=factory.Create<IFoo>();
varbar=factory.Create<IBar>();
//thissetupwillbeverifiedwhenweverifythefactory
foo.Setup(f=>f.Do()).Verifiable();
//thissetupwillNOTbeverified
foo.Setup(f=>f.Calculate());
//thissetupwillbeverifiedwhenweverifythefactory
bar.Setup(b=>b.Redo()).Verifiable();
![Page 358: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/358.jpg)
Copy
//exercisethemockshere
//notethatbecausethemocksareLoose,members
//calledintheinterfacesforwhichnomatching
//setupsexistwillNOTthrowexceptions,
//andwillratherreturndefaultvalues.
factory.Verify();
//Atthispointverifiablesetupsarealreadychecked
//andanoptionalMockExceptionmightbethrown.
Thefollowingexamplesshowshowtosetupthefactorywithadefaultstrictbehavior,overridingthatdefaultforaspecificmock:
C#
varfactory=newMockFactory(MockBehavior.Strict);
//thisparticularonewewantloose
varfoo=factory.Create<IFoo>(MockBehavior.Loose);
varbar=factory.Create<IBar>();
//specifysetups
//exercisethemockshere
factory.Verify();
![Page 359: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/359.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..MockFactoryMoq..::..MockRepository
![Page 360: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/360.jpg)
SeeAlsoMockFactoryMembersMoqNamespaceMoq..::..MockBehavior
![Page 361: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/361.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockFactoryMembersMockFactoryClassConstructorsMethodsPropertiesSeeAlsoSendFeedback
TheMockFactorytypeexposesthefollowingmembers.
![Page 362: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/362.jpg)
Constructors Name Description
MockFactory InitializesthefactorywiththegivendefaultBehaviorfornewlycreatedmocksfromthefactory.
![Page 363: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/363.jpg)
Methods Name Description
Create<(Of<<'(T>)>>)()()()()CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontime.
Create<(Of<<'(T>)>>)(array<Object>[]()[][])
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontimeandwiththethegivenconstructorargumentsfortheclass.
Create<(Of<<'(T>)>>)(MockBehavior)
Createsanewmockwiththegivenbehavior.
Create<(Of<<'(T>)>>)(MockBehavior,array<Object>[]()[][])
Createsanewmockwiththegivenbehaviorandwiththethegivenconstructorargumentsfortheclass.
CreateMock<(Of<<'(T>)>>) Implementscreationofanewmockwithinthefactory.
Verify Verifiesallverifiableexpectationsonallmockscreatedbythisfactory.
VerifyAll Verifiesallverifiableexpectationsonallmockscreatedbythisfactory.
VerifyMocks
InvokesverifyActionforeachmockinMocks,andaccumulatestheresultingMockVerificationExceptionthatmightbethrownfromtheaction.
![Page 364: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/364.jpg)
Properties Name Description
CallBaseWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).
DefaultValue Specifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.
Mocks Getsthemocksthathavebeencreatedbythisfactoryandthatwillgetverifiedtogether.
![Page 366: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/366.jpg)
C#
MoqMockFactoryConstructorMockFactoryClassSeeAlsoSendFeedbackInitializesthefactorywiththegivendefaultBehaviorfornewlycreatedmocksfromthefactory.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 367: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/367.jpg)
SyntaxC#
publicMockFactory(
MockBehaviordefaultBehavior
)
Parameters
defaultBehaviorType:Moq..::..MockBehaviorThebehaviortouseformockscreatedusingtheCreate<(Of<<'(T>)>>)()()()()factorymethodifnotoverridenbyusingtheCreate<(Of<<'(T>)>>)(MockBehavior)overload.
![Page 369: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/369.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockFactoryMethodsMockFactoryClassSeeAlsoSendFeedback
TheMockFactorytypeexposesthefollowingmembers.
![Page 370: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/370.jpg)
Methods Name Description
Create<(Of<<'(T>)>>)()()()()CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontime.
Create<(Of<<'(T>)>>)(array<Object>[]()[][])
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontimeandwiththethegivenconstructorargumentsfortheclass.
Create<(Of<<'(T>)>>)(MockBehavior)
Createsanewmockwiththegivenbehavior.
Create<(Of<<'(T>)>>)(MockBehavior,array<Object>[]()[][])
Createsanewmockwiththegivenbehaviorandwiththethegivenconstructorargumentsfortheclass.
CreateMock<(Of<<'(T>)>>) Implementscreationofanewmockwithinthefactory.
Verify Verifiesallverifiableexpectationsonallmockscreatedbythisfactory.
VerifyAll Verifiesallverifiableexpectationsonallmockscreatedbythisfactory.
VerifyMocks
InvokesverifyActionforeachmockinMocks,andaccumulatestheresultingMockVerificationExceptionthatmightbethrownfromtheaction.
![Page 372: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/372.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockFactory..::..CreateMethodMockFactoryClassSeeAlsoSendFeedback
![Page 373: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/373.jpg)
OverloadList Name Description
Create<(Of<<'(T>)>>)()()()()CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontime.
Create<(Of<<'(T>)>>)(array<Object>[]()[][])
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontimeandwiththethegivenconstructorargumentsfortheclass.
Create<(Of<<'(T>)>>)(MockBehavior)
Createsanewmockwiththegivenbehavior.
Create<(Of<<'(T>)>>)(MockBehavior,array<Object>[]()[][])
Createsanewmockwiththegivenbehaviorandwiththethegivenconstructorargumentsfortheclass.
![Page 374: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/374.jpg)
SeeAlsoMockFactoryClassMockFactoryMembersMoqNamespace
![Page 375: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/375.jpg)
C#
MoqMockFactory..::..Create<(Of<(<'T>)>)>MethodMockFactoryClassExampleSeeAlsoSendFeedbackCreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontime.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 376: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/376.jpg)
SyntaxC#
publicMock<T>Create<T>()
whereT:class
![Page 377: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/377.jpg)
TypeParametersT
Typetomock.
ReturnValue
AnewMock<(Of<(<'T>)>)>.
![Page 378: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/378.jpg)
Copy
ExamplesC#
varfactory=newMockFactory(MockBehavior.Strict);
varfoo=factory.Create<IFoo>();
//usemockontests
factory.VerifyAll();
![Page 379: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/379.jpg)
SeeAlsoMockFactoryClassCreateOverloadMoqNamespace
![Page 380: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/380.jpg)
C#
MoqMockFactory..::..Create<(Of<(<'T>)>)>Method(array<Object>[]()[][])MockFactoryClassExampleSeeAlsoSendFeedbackCreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontimeandwiththethegivenconstructorargumentsfortheclass.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 381: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/381.jpg)
SyntaxC#
publicMock<T>Create<T>(
paramsObject[]args
)
whereT:class
Parameters
argsType:array<System..::..Object>[]()[][]Constructorargumentsformockedclasses.
![Page 382: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/382.jpg)
TypeParametersT
Typetomock.
ReturnValue
AnewMock<(Of<(<'T>)>)>.
![Page 383: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/383.jpg)
RemarksThemockwilltrytofindthebestmatchconstructorgiventheconstructorarguments,andinvokethattoinitializetheinstance.Thisappliesonlytoclasses,notinterfaces.
![Page 384: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/384.jpg)
Copy
ExamplesC#
varfactory=newMockFactory(MockBehavior.Default);
varmock=factory.Create<MyBase>("Foo",25,true);
//usemockontests
factory.Verify();
![Page 385: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/385.jpg)
SeeAlsoMockFactoryClassCreateOverloadMoqNamespace
![Page 386: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/386.jpg)
C#
MoqMockFactory..::..Create<(Of<(<'T>)>)>Method(MockBehavior)MockFactoryClassExampleSeeAlsoSendFeedbackCreatesanewmockwiththegivenbehavior.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 387: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/387.jpg)
SyntaxC#
publicMock<T>Create<T>(
MockBehaviorbehavior
)
whereT:class
Parameters
behaviorType:Moq..::..MockBehaviorBehaviortouseforthemock,whichoverridesthedefaultbehaviorspecifiedatfactoryconstructiontime.
![Page 388: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/388.jpg)
TypeParametersT
Typetomock.
ReturnValue
AnewMock<(Of<(<'T>)>)>.
![Page 389: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/389.jpg)
Copy
ExamplesThefollowingexampleshowshowtocreateamockwithadifferentbehaviortothatspecifiedasthedefaultforthefactory:
C#
varfactory=newMockFactory(MockBehavior.Strict);
varfoo=factory.Create<IFoo>(MockBehavior.Loose);
![Page 390: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/390.jpg)
SeeAlsoMockFactoryClassCreateOverloadMoqNamespace
![Page 391: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/391.jpg)
C#
MoqMockFactory..::..Create<(Of<(<'T>)>)>Method(MockBehavior,array<Object>[]()[][])MockFactoryClassExampleSeeAlsoSendFeedbackCreatesanewmockwiththegivenbehaviorandwiththethegivenconstructorargumentsfortheclass.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 392: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/392.jpg)
SyntaxC#
publicMock<T>Create<T>(
MockBehaviorbehavior,
paramsObject[]args
)
whereT:class
Parameters
behaviorType:Moq..::..MockBehaviorBehaviortouseforthemock,whichoverridesthedefaultbehaviorspecifiedatfactoryconstructiontime.
argsType:array<System..::..Object>[]()[][]Constructorargumentsformockedclasses.
![Page 393: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/393.jpg)
TypeParametersT
Typetomock.
ReturnValue
AnewMock<(Of<(<'T>)>)>.
![Page 394: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/394.jpg)
RemarksThemockwilltrytofindthebestmatchconstructorgiventheconstructorarguments,andinvokethattoinitializetheinstance.Thisappliesonlytoclasses,notinterfaces.
![Page 395: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/395.jpg)
Copy
ExamplesThefollowingexampleshowshowtocreateamockwithadifferentbehaviortothatspecifiedasthedefaultforthefactory,passingconstructorarguments:
C#
varfactory=newMockFactory(MockBehavior.Default);
varmock=factory.Create<MyBase>(MockBehavior.Strict,"Foo",25,true
![Page 396: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/396.jpg)
SeeAlsoMockFactoryClassCreateOverloadMoqNamespace
![Page 397: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/397.jpg)
C#
MoqMockFactory..::..CreateMock<(Of<(<'T>)>)>MethodMockFactoryClassSeeAlsoSendFeedbackImplementscreationofanewmockwithinthefactory.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 398: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/398.jpg)
SyntaxC#
protectedvirtualMock<T>CreateMock<T>(
MockBehaviorbehavior,
Object[]args
)
whereT:class
Parameters
behaviorType:Moq..::..MockBehaviorThebehaviorforthenewmock.
argsType:array<System..::..Object>[]()[][]Optionalargumentsfortheconstructionofthemock.
![Page 399: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/399.jpg)
TypeParametersT
Typetomock.
![Page 401: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/401.jpg)
C#
MoqMockFactory..::..VerifyMethodMockFactoryClassSeeAlsoSendFeedbackVerifiesallverifiableexpectationsonallmockscreatedbythisfactory.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 402: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/402.jpg)
SyntaxC#
publicvirtualvoidVerify()
![Page 403: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/403.jpg)
ExceptionsException Condition
Moq..::..MockException Oneormoremockshadexpectationsthatwerenotsatisfied.
![Page 404: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/404.jpg)
SeeAlsoMockFactoryClassMoqNamespaceMock..::..Verify()()()()
![Page 405: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/405.jpg)
C#
MoqMockFactory..::..VerifyAllMethodMockFactoryClassSeeAlsoSendFeedbackVerifiesallverifiableexpectationsonallmockscreatedbythisfactory.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 406: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/406.jpg)
SyntaxC#
publicvirtualvoidVerifyAll()
![Page 407: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/407.jpg)
ExceptionsException Condition
Moq..::..MockException Oneormoremockshadexpectationsthatwerenotsatisfied.
![Page 408: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/408.jpg)
SeeAlsoMockFactoryClassMoqNamespaceMock..::..Verify()()()()
![Page 409: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/409.jpg)
C#
MoqMockFactory..::..VerifyMocksMethodMockFactoryClassSeeAlsoSendFeedbackInvokesverifyActionforeachmockinMocks,andaccumulatestheresultingMockVerificationExceptionthatmightbethrownfromtheaction.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 410: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/410.jpg)
SyntaxC#
protectedvirtualvoidVerifyMocks(
Action<Mock>verifyAction
)
Parameters
verifyActionType:System..::..Action<(Of<(<'Mock>)>)>Theactiontoexecuteagainsteachmock.
![Page 412: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/412.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockFactoryPropertiesMockFactoryClassSeeAlsoSendFeedback
TheMockFactorytypeexposesthefollowingmembers.
![Page 413: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/413.jpg)
Properties Name Description
CallBaseWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).
DefaultValue Specifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.
Mocks Getsthemocksthathavebeencreatedbythisfactoryandthatwillgetverifiedtogether.
![Page 415: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/415.jpg)
C#
MoqMockFactory..::..CallBasePropertyMockFactoryClassSeeAlsoSendFeedbackWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 418: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/418.jpg)
C#
MoqMockFactory..::..DefaultValuePropertyMockFactoryClassSeeAlsoSendFeedbackSpecifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 419: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/419.jpg)
SyntaxC#
publicDefaultValueDefaultValue{get;set;}
![Page 421: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/421.jpg)
C#
MoqMockFactory..::..MocksPropertyMockFactoryClassSeeAlsoSendFeedbackGetsthemocksthathavebeencreatedbythisfactoryandthatwillgetverifiedtogether.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 422: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/422.jpg)
SyntaxC#
protectedinternalIEnumerable<Mock>Mocks{get;}
![Page 424: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/424.jpg)
C#
MoqMockRepositoryClassMembersExampleSeeAlsoSendFeedbackUtilityrepositoryclasstousetoconstructmultiplemockswhenconsistentverificationisdesiredforallofthem.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 425: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/425.jpg)
SyntaxC#
publicclassMockRepository:MockFactory
![Page 426: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/426.jpg)
RemarksIfmultiplemockswillbecreatedduringatest,passingthedesiredMockBehavior(ifdifferentthantheDefaultortheonepassedtotherepositoryconstructor)andlaterverifyingeachmockcanbecomerepetitiveandtedious.
ThisrepositoryclasshelpsinthatscenariobyprovidingasimplifiedcreationofmultiplemockswithadefaultMockBehavior(unlessoverridenbycallingCreate<(Of<<'(T>)>>)(MockBehavior))andposteriorverification.
![Page 427: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/427.jpg)
Copy
Copy
ExamplesThefollowingisastraightforwardexampleonhowtocreateandautomaticallyverifystrictmocksusingaMockRepository:
C#
varrepository=newMockRepository(MockBehavior.Strict);
varfoo=repository.Create<IFoo>();
varbar=repository.Create<IBar>();
//noneedtocallVerifiable()onthesetup
//aswe'llbevalidatingallofthemanyway.
foo.Setup(f=>f.Do());
bar.Setup(b=>b.Redo());
//exercisethemockshere
repository.VerifyAll();
//Atthispointallsetupsarealreadychecked
//andanoptionalMockExceptionmightbethrown.
//Notealsothatbecausethemocksarestrict,anyinvocation
//thatdoesn'thaveamatchingsetupwillalsothrowaMockException.
Thefollowingexamplesshowshowtosetuptherepositorytocreateloosemocksandlaterverifyonlyverifiablesetups:
C#
varrepository=newMockRepository(MockBehavior.Loose);
varfoo=repository.Create<IFoo>();
varbar=repository.Create<IBar>();
//thissetupwillbeverifiedwhenweverifytherepository
foo.Setup(f=>f.Do()).Verifiable();
//thissetupwillNOTbeverified
foo.Setup(f=>f.Calculate());
//thissetupwillbeverifiedwhenweverifytherepository
bar.Setup(b=>b.Redo()).Verifiable();
![Page 428: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/428.jpg)
Copy
//exercisethemockshere
//notethatbecausethemocksareLoose,members
//calledintheinterfacesforwhichnomatching
//setupsexistwillNOTthrowexceptions,
//andwillratherreturndefaultvalues.
repository.Verify();
//Atthispointverifiablesetupsarealreadychecked
//andanoptionalMockExceptionmightbethrown.
Thefollowingexamplesshowshowtosetuptherepositorywithadefaultstrictbehavior,overridingthatdefaultforaspecificmock:
C#
varrepository=newMockRepository(MockBehavior.Strict);
//thisparticularonewewantloose
varfoo=repository.Create<IFoo>(MockBehavior.Loose);
varbar=repository.Create<IBar>();
//specifysetups
//exercisethemockshere
repository.Verify();
![Page 429: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/429.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..MockFactoryMoq..::..MockRepository
![Page 430: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/430.jpg)
SeeAlsoMockRepositoryMembersMoqNamespaceMoq..::..MockBehavior
![Page 431: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/431.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockRepositoryMembersMockRepositoryClassConstructorsMethodsPropertiesSeeAlsoSendFeedback
TheMockRepositorytypeexposesthefollowingmembers.
![Page 432: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/432.jpg)
Constructors Name Description
MockRepositoryInitializestherepositorywiththegivendefaultBehaviorfornewlycreatedmocksfromtherepository.
![Page 433: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/433.jpg)
Methods Name Description
Create<(Of<<'(T>)>>)()()()()
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontime.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(array<Object>[]()[][])
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontimeandwiththethegivenconstructorargumentsfortheclass.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(MockBehavior)
Createsanewmockwiththegivenbehavior.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(MockBehavior,array<Object>[]()[][])
Createsanewmockwiththegivenbehaviorandwiththethegivenconstructorargumentsfortheclass.(InheritedfromMockFactory.)
CreateMock<(Of<<'(T>)>>)Implementscreationofanewmockwithinthefactory.(InheritedfromMockFactory.)
Of<(Of<<'(T>)>>)()()()()
Accesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
OneOf<(Of<<'(T>)>>)()()()() Createsanmockobjectoftheindicatedtype.
OneOf<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
![Page 434: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/434.jpg)
VerifyVerifiesallverifiableexpectationsonallmockscreatedbythisfactory.(InheritedfromMockFactory.)
VerifyAllVerifiesallverifiableexpectationsonallmockscreatedbythisfactory.(InheritedfromMockFactory.)
VerifyMocks
InvokesverifyActionforeachmockinMocks,andaccumulatestheresultingMockVerificationExceptionthatmightbethrownfromtheaction.(InheritedfromMockFactory.)
![Page 435: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/435.jpg)
Properties Name Description
CallBase
Whetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).(InheritedfromMockFactory.)
DefaultValueSpecifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.(InheritedfromMockFactory.)
MocksGetsthemocksthathavebeencreatedbythisfactoryandthatwillgetverifiedtogether.(InheritedfromMockFactory.)
![Page 436: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/436.jpg)
SeeAlsoMockRepositoryClassMoqNamespace
![Page 437: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/437.jpg)
C#
MoqMockRepositoryConstructorMockRepositoryClassSeeAlsoSendFeedbackInitializestherepositorywiththegivendefaultBehaviorfornewlycreatedmocksfromtherepository.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 438: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/438.jpg)
SyntaxC#
publicMockRepository(
MockBehaviordefaultBehavior
)
Parameters
defaultBehaviorType:Moq..::..MockBehaviorThebehaviortouseformockscreatedusingtheCreate<(Of<<'(T>)>>)()()()()repositorymethodifnotoverridenbyusingtheCreate<(Of<<'(T>)>>)(MockBehavior)overload.
![Page 439: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/439.jpg)
SeeAlsoMockRepositoryClassMoqNamespace
![Page 440: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/440.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockRepositoryMethodsMockRepositoryClassSeeAlsoSendFeedback
TheMockRepositorytypeexposesthefollowingmembers.
![Page 441: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/441.jpg)
Methods Name Description
Create<(Of<<'(T>)>>)()()()()
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontime.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(array<Object>[]()[][])
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontimeandwiththethegivenconstructorargumentsfortheclass.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(MockBehavior)
Createsanewmockwiththegivenbehavior.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(MockBehavior,array<Object>[]()[][])
Createsanewmockwiththegivenbehaviorandwiththethegivenconstructorargumentsfortheclass.(InheritedfromMockFactory.)
CreateMock<(Of<<'(T>)>>)Implementscreationofanewmockwithinthefactory.(InheritedfromMockFactory.)
Of<(Of<<'(T>)>>)()()()()
Accesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
OneOf<(Of<<'(T>)>>)()()()() Createsanmockobjectoftheindicatedtype.
OneOf<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
![Page 442: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/442.jpg)
VerifyVerifiesallverifiableexpectationsonallmockscreatedbythisfactory.(InheritedfromMockFactory.)
VerifyAllVerifiesallverifiableexpectationsonallmockscreatedbythisfactory.(InheritedfromMockFactory.)
VerifyMocks
InvokesverifyActionforeachmockinMocks,andaccumulatestheresultingMockVerificationExceptionthatmightbethrownfromtheaction.(InheritedfromMockFactory.)
![Page 443: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/443.jpg)
SeeAlsoMockRepositoryClassMoqNamespace
![Page 444: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/444.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockRepository..::..CreateMethodMockRepositoryClassSeeAlsoSendFeedback
![Page 445: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/445.jpg)
OverloadList Name Description
Create<(Of<<'(T>)>>)()()()()
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontime.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(array<Object>[]()[][])
CreatesanewmockwiththedefaultMockBehaviorspecifiedatfactoryconstructiontimeandwiththethegivenconstructorargumentsfortheclass.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(MockBehavior)
Createsanewmockwiththegivenbehavior.(InheritedfromMockFactory.)
Create<(Of<<'(T>)>>)(MockBehavior,array<Object>[]()[][])
Createsanewmockwiththegivenbehaviorandwiththethegivenconstructorargumentsfortheclass.(InheritedfromMockFactory.)
![Page 446: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/446.jpg)
SeeAlsoMockRepositoryClassMockRepositoryMembersMoqNamespace
![Page 447: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/447.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockRepository..::..OfMethodMockRepositoryClassSeeAlsoSendFeedback
![Page 448: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/448.jpg)
OverloadList Name Description
Of<(Of<<'(T>)>>)()()()()Accesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
![Page 449: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/449.jpg)
SeeAlsoMockRepositoryClassMockRepositoryMembersMoqNamespace
![Page 450: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/450.jpg)
C#
MoqMockRepository..::..Of<(Of<(<'T>)>)>MethodMockRepositoryClassSeeAlsoSendFeedbackAccesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 452: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/452.jpg)
TypeParametersT
Thetypeofthemockedobjecttoquery.
![Page 453: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/453.jpg)
SeeAlsoMockRepositoryClassOfOverloadMoqNamespace
![Page 454: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/454.jpg)
C#
MoqMockRepository..::..Of<(Of<(<'T>)>)>Method(Expression<(Of<(<'Func>)>)>)MockRepositoryClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.MockRepository.Of``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 455: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/455.jpg)
SyntaxC#
publicIQueryable<T>Of<T>(
Expression<Func>specification
)
whereT:class
Parameters
specificationType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 456: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/456.jpg)
TypeParametersT
![Page 457: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/457.jpg)
SeeAlsoMockRepositoryClassOfOverloadMoqNamespace
![Page 458: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/458.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockRepository..::..OneOfMethodMockRepositoryClassSeeAlsoSendFeedback
![Page 459: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/459.jpg)
OverloadList Name Description
OneOf<(Of<<'(T>)>>)()()()() Createsanmockobjectoftheindicatedtype.
OneOf<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
![Page 460: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/460.jpg)
SeeAlsoMockRepositoryClassMockRepositoryMembersMoqNamespace
![Page 461: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/461.jpg)
C#
MoqMockRepository..::..OneOf<(Of<(<'T>)>)>MethodMockRepositoryClassSeeAlsoSendFeedbackCreatesanmockobjectoftheindicatedtype.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 462: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/462.jpg)
SyntaxC#
publicTOneOf<T>()
whereT:class
![Page 463: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/463.jpg)
TypeParametersT
Thetypeofthemockedobject.
ReturnValue
Themockedobjectcreated.
![Page 464: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/464.jpg)
SeeAlsoMockRepositoryClassOneOfOverloadMoqNamespace
![Page 465: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/465.jpg)
C#
MoqMockRepository..::..OneOf<(Of<(<'T>)>)>Method(Expression<(Of<(<'Func>)>)>)MockRepositoryClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.MockRepository.OneOf``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 466: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/466.jpg)
SyntaxC#
publicTOneOf<T>(
Expression<Func>specification
)
whereT:class
Parameters
specificationType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 467: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/467.jpg)
TypeParametersT
![Page 468: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/468.jpg)
SeeAlsoMockRepositoryClassOneOfOverloadMoqNamespace
![Page 469: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/469.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockRepositoryPropertiesMockRepositoryClassSeeAlsoSendFeedback
TheMockRepositorytypeexposesthefollowingmembers.
![Page 470: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/470.jpg)
Properties Name Description
CallBase
Whetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).(InheritedfromMockFactory.)
DefaultValueSpecifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.(InheritedfromMockFactory.)
MocksGetsthemocksthathavebeencreatedbythisfactoryandthatwillgetverifiedtogether.(InheritedfromMockFactory.)
![Page 471: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/471.jpg)
SeeAlsoMockRepositoryClassMoqNamespace
![Page 472: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/472.jpg)
C#
MoqMocksClassMembersSeeAlsoSendFeedbackAllowsqueryingtheuniverseofmocksforthosethatbehaveaccordingtotheLINQqueryspecification.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 473: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/473.jpg)
SyntaxC#
publicstaticclassMocks
![Page 474: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/474.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..Mocks
![Page 476: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/476.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMocksMembersMocksClassMethodsSeeAlsoSendFeedback
![Page 477: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/477.jpg)
Methods Name Description
Of<(Of<<'(T>)>>)()()()()
Accesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
OneOf<(Of<<'(T>)>>)()()()()
Obsolete.Createsanmockobjectoftheindicatedtype.
OneOf<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
Obsolete.
![Page 479: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/479.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMocksMethodsMocksClassSeeAlsoSendFeedback
![Page 480: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/480.jpg)
Methods Name Description
Of<(Of<<'(T>)>>)()()()()
Accesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
OneOf<(Of<<'(T>)>>)()()()()
Obsolete.Createsanmockobjectoftheindicatedtype.
OneOf<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
Obsolete.
![Page 482: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/482.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMocks..::..OfMethodMocksClassSeeAlsoSendFeedback
![Page 483: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/483.jpg)
OverloadList Name Description
Of<(Of<<'(T>)>>)()()()()Accesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.
Of<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
![Page 484: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/484.jpg)
SeeAlsoMocksClassMocksMembersMoqNamespace
![Page 485: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/485.jpg)
C#
MoqMocks..::..Of<(Of<(<'T>)>)>MethodMocksClassSeeAlsoSendFeedbackAccesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 486: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/486.jpg)
SyntaxC#
publicstaticIQueryable<T>Of<T>()
whereT:class
![Page 487: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/487.jpg)
TypeParametersT
Thetypeofthemockedobjecttoquery.
![Page 488: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/488.jpg)
SeeAlsoMocksClassOfOverloadMoqNamespace
![Page 489: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/489.jpg)
C#
MoqMocks..::..Of<(Of<(<'T>)>)>Method(Expression<(Of<(<'Func>)>)>)MocksClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mocks.Of``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 490: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/490.jpg)
SyntaxC#
publicstaticIQueryable<T>Of<T>(
Expression<Func>specification
)
whereT:class
Parameters
specificationType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 491: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/491.jpg)
TypeParametersT
![Page 492: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/492.jpg)
SeeAlsoMocksClassOfOverloadMoqNamespace
![Page 493: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/493.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMocks..::..OneOfMethodMocksClassSeeAlsoSendFeedback
![Page 494: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/494.jpg)
OverloadList Name Description
OneOf<(Of<<'(T>)>>)()()()()Obsolete.Createsanmockobjectoftheindicatedtype.
OneOf<(Of<<'(T>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>)) Obsolete.
![Page 495: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/495.jpg)
SeeAlsoMocksClassMocksMembersMoqNamespace
![Page 496: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/496.jpg)
C#
MoqMocks..::..OneOf<(Of<(<'T>)>)>MethodMocksClassSeeAlsoSendFeedbackCreatesanmockobjectoftheindicatedtype.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 497: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/497.jpg)
SyntaxC#
[ObsoleteAttribute("MovedtoMock.Of<T>,asit'sasingleone,sonoreasontobeonMocks.",
true)]
publicstaticTOneOf<T>()
whereT:class
![Page 498: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/498.jpg)
TypeParametersT
Thetypeofthemockedobject.
ReturnValue
Themockedobjectcreated.
![Page 499: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/499.jpg)
SeeAlsoMocksClassOneOfOverloadMoqNamespace
![Page 500: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/500.jpg)
C#
MoqMocks..::..OneOf<(Of<(<'T>)>)>Method(Expression<(Of<(<'Func>)>)>)MocksClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Mocks.OneOf``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 501: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/501.jpg)
SyntaxC#
[ObsoleteAttribute("MovedtoMock.Of<T>,asit'sasingleone,sonoreasontobeonMocks.",
true)]
publicstaticTOneOf<T>(
Expression<Func>specification
)
whereT:class
Parameters
specificationType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 502: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/502.jpg)
TypeParametersT
![Page 503: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/503.jpg)
SeeAlsoMocksClassOneOfOverloadMoqNamespace
![Page 504: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/504.jpg)
C#
MoqMockSequenceClassMembersSeeAlsoSendFeedbackHelperclasstosetupafulltracebetweenmanymocks
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 505: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/505.jpg)
SyntaxC#
publicclassMockSequence
![Page 506: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/506.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..MockSequence
![Page 507: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/507.jpg)
SeeAlsoMockSequenceMembersMoqNamespace
![Page 508: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/508.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockSequenceMembersMockSequenceClassConstructorsPropertiesSeeAlsoSendFeedback
TheMockSequencetypeexposesthefollowingmembers.
![Page 509: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/509.jpg)
Constructors Name DescriptionMockSequence Initializeatracesetup
![Page 510: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/510.jpg)
Properties Name DescriptionCyclic Allowsequencetoberepeated
![Page 511: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/511.jpg)
SeeAlsoMockSequenceClassMoqNamespace
![Page 512: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/512.jpg)
C#
MoqMockSequenceConstructorMockSequenceClassSeeAlsoSendFeedbackInitializeatracesetup
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 513: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/513.jpg)
SyntaxC#
publicMockSequence()
![Page 514: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/514.jpg)
SeeAlsoMockSequenceClassMoqNamespace
![Page 515: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/515.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockSequencePropertiesMockSequenceClassSeeAlsoSendFeedback
TheMockSequencetypeexposesthefollowingmembers.
![Page 516: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/516.jpg)
Properties Name DescriptionCyclic Allowsequencetoberepeated
![Page 517: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/517.jpg)
SeeAlsoMockSequenceClassMoqNamespace
![Page 518: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/518.jpg)
C#
MoqMockSequence..::..CyclicPropertyMockSequenceClassSeeAlsoSendFeedbackAllowsequencetoberepeated
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 520: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/520.jpg)
SeeAlsoMockSequenceClassMoqNamespace
![Page 521: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/521.jpg)
C#
MoqMockSequenceHelperClassMembersSeeAlsoSendFeedbackdefineniceapi
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 522: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/522.jpg)
SyntaxC#
publicstaticclassMockSequenceHelper
![Page 523: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/523.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..MockSequenceHelper
![Page 524: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/524.jpg)
SeeAlsoMockSequenceHelperMembersMoqNamespace
![Page 525: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/525.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockSequenceHelperMembersMockSequenceHelperClassMethodsSeeAlsoSendFeedback
TheMockSequenceHelpertypeexposesthefollowingmembers.
![Page 526: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/526.jpg)
Methods Name Description
InSequence<(Of<<'(TMock>)>>) Performanexpectationinthetrace.
![Page 527: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/527.jpg)
SeeAlsoMockSequenceHelperClassMoqNamespace
![Page 528: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/528.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqMockSequenceHelperMethodsMockSequenceHelperClassSeeAlsoSendFeedback
TheMockSequenceHelpertypeexposesthefollowingmembers.
![Page 529: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/529.jpg)
Methods Name Description
InSequence<(Of<<'(TMock>)>>) Performanexpectationinthetrace.
![Page 530: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/530.jpg)
SeeAlsoMockSequenceHelperClassMoqNamespace
![Page 531: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/531.jpg)
C#
MoqMockSequenceHelper..::..InSequence<(Of<(<'TMock>)>)>MethodMockSequenceHelperClassSeeAlsoSendFeedbackPerformanexpectationinthetrace.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 532: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/532.jpg)
SyntaxC#
publicstaticISetupConditionResult<TMock>InSequence<TMock>(
thisMock<TMock>mock,
MockSequencesequence
)
whereTMock:class
Parameters
mockType:Moq..::..Mock<(Of<(<'TMock>)>)>
sequenceType:Moq..::..MockSequence
![Page 533: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/533.jpg)
TypeParametersTMock
![Page 534: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/534.jpg)
SeeAlsoMockSequenceHelperClassMoqNamespace
![Page 535: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/535.jpg)
C#
MoqRangeEnumerationSeeAlsoSendFeedbackKindofrangetouseinafilterspecifiedthroughIsInRange<(Of<<'(TValue>)>>)(TValue,TValue,Range).
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 536: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/536.jpg)
SyntaxC#
publicenumRange
![Page 537: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/537.jpg)
MembersMembername DescriptionInclusiveExclusive
![Page 539: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/539.jpg)
C#
MoqSequenceExtensionsClassMembersSeeAlsoSendFeedbackHelperforsequencingreturnvaluesinthesamemethod.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 540: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/540.jpg)
SyntaxC#
publicstaticclassSequenceExtensions
![Page 541: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/541.jpg)
InheritanceHierarchySystem..::..ObjectMoq..::..SequenceExtensions
![Page 542: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/542.jpg)
SeeAlsoSequenceExtensionsMembersMoqNamespace
![Page 543: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/543.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqSequenceExtensionsMembersSequenceExtensionsClassMethodsSeeAlsoSendFeedback
TheSequenceExtensionstypeexposesthefollowingmembers.
![Page 544: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/544.jpg)
Methods Name Description
SetupSequence<(Of<<'(TMock,TResult>)>>)
![Page 545: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/545.jpg)
SeeAlsoSequenceExtensionsClassMoqNamespace
![Page 546: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/546.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqSequenceExtensionsMethodsSequenceExtensionsClassSeeAlsoSendFeedback
TheSequenceExtensionstypeexposesthefollowingmembers.
![Page 547: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/547.jpg)
Methods Name Description
SetupSequence<(Of<<'(TMock,TResult>)>>)
![Page 548: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/548.jpg)
SeeAlsoSequenceExtensionsClassMoqNamespace
![Page 549: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/549.jpg)
C#
MoqSequenceExtensions..::..SetupSequence<(Of<(<'TMock,TResult>)>)>MethodSequenceExtensionsClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.SequenceExtensions.SetupSequence``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 550: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/550.jpg)
SyntaxC#
publicstaticISetupSequentialResult<TResult>SetupSequence<TMock,TResult>(
thisMock<TMock>mock,
Expression<Func>expression
)
whereTMock:class
Parameters
mockType:Moq..::..Mock<(Of<(<'TMock>)>)>
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 551: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/551.jpg)
TypeParametersTMockTResult
![Page 552: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/552.jpg)
SeeAlsoSequenceExtensionsClassMoqNamespace
![Page 553: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/553.jpg)
C#
MoqTimesStructureMembersSeeAlsoSendFeedbackDefinesthenumberofinvocationsallowedbyamockedmethod.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 554: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/554.jpg)
SyntaxC#
publicstructTimes
![Page 556: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/556.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqTimesMembersTimesStructureMethodsOperatorsSeeAlsoSendFeedback
TheTimestypeexposesthefollowingmembers.
![Page 557: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/557.jpg)
Methods Name Description
AtLeast SpecifiesthatamockedmethodshouldbeinvokedcallCounttimesasminimum.
AtLeastOnce Specifiesthatamockedmethodshouldbeinvokedonetimeasminimum.
AtMost SpecifiesthatamockedmethodshouldbeinvokedcallCounttimeasmaximun.
AtMostOnce Specifiesthatamockedmethodshouldbeinvokedonetimeasmaximun.
Between SpecifiesthatamockedmethodshouldbeinvokedbetweencallCountFromandcallCountTotimes.
EqualsDetermineswhetherthespecifiedObjectisequaltothisinstance.(OverridesValueType..::..Equals(Object).)
Exactly SpecifiesthatamockedmethodshouldbeinvokedexactlycallCounttimes.
GetHashCode Returnsahashcodeforthisinstance.(OverridesValueType..::..GetHashCode()()()().)Never Specifiesthatamockedmethodshouldnotbeinvoked.
Once Specifiesthatamockedmethodshouldbeinvokedexactlyonetime.
![Page 558: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/558.jpg)
Operators Name Description
Equality DetermineswhethertwospecifiedTimesobjectshavethesamevalue.
Inequality DetermineswhethertwospecifiedTimesobjectshavedifferentvalues.
![Page 560: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/560.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqTimesMethodsTimesStructureSeeAlsoSendFeedback
TheTimestypeexposesthefollowingmembers.
![Page 561: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/561.jpg)
Methods Name Description
AtLeast SpecifiesthatamockedmethodshouldbeinvokedcallCounttimesasminimum.
AtLeastOnce Specifiesthatamockedmethodshouldbeinvokedonetimeasminimum.
AtMost SpecifiesthatamockedmethodshouldbeinvokedcallCounttimeasmaximun.
AtMostOnce Specifiesthatamockedmethodshouldbeinvokedonetimeasmaximun.
Between SpecifiesthatamockedmethodshouldbeinvokedbetweencallCountFromandcallCountTotimes.
EqualsDetermineswhetherthespecifiedObjectisequaltothisinstance.(OverridesValueType..::..Equals(Object).)
Exactly SpecifiesthatamockedmethodshouldbeinvokedexactlycallCounttimes.
GetHashCode Returnsahashcodeforthisinstance.(OverridesValueType..::..GetHashCode()()()().)Never Specifiesthatamockedmethodshouldnotbeinvoked.
Once Specifiesthatamockedmethodshouldbeinvokedexactlyonetime.
![Page 563: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/563.jpg)
C#
MoqTimes..::..AtLeastMethodTimesStructureSeeAlsoSendFeedbackSpecifiesthatamockedmethodshouldbeinvokedcallCounttimesasminimum.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 564: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/564.jpg)
SyntaxC#
publicstaticTimesAtLeast(
intcallCount
)
Parameters
callCountType:System..::..Int32Theminimunnumberoftimes.
ReturnValue
Anobjectdefiningtheallowednumberofinvocations.
![Page 566: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/566.jpg)
C#
MoqTimes..::..AtLeastOnceMethodTimesStructureSeeAlsoSendFeedbackSpecifiesthatamockedmethodshouldbeinvokedonetimeasminimum.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 567: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/567.jpg)
SyntaxC#
publicstaticTimesAtLeastOnce()
ReturnValue
Anobjectdefiningtheallowednumberofinvocations.
![Page 569: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/569.jpg)
C#
MoqTimes..::..AtMostMethodTimesStructureSeeAlsoSendFeedbackSpecifiesthatamockedmethodshouldbeinvokedcallCounttimeasmaximun.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 570: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/570.jpg)
SyntaxC#
publicstaticTimesAtMost(
intcallCount
)
Parameters
callCountType:System..::..Int32Themaximunnumberoftimes.
ReturnValue
Anobjectdefiningtheallowednumberofinvocations.
![Page 572: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/572.jpg)
C#
MoqTimes..::..AtMostOnceMethodTimesStructureSeeAlsoSendFeedbackSpecifiesthatamockedmethodshouldbeinvokedonetimeasmaximun.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 573: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/573.jpg)
SyntaxC#
publicstaticTimesAtMostOnce()
ReturnValue
Anobjectdefiningtheallowednumberofinvocations.
![Page 575: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/575.jpg)
C#
MoqTimes..::..BetweenMethodTimesStructureSeeAlsoSendFeedbackSpecifiesthatamockedmethodshouldbeinvokedbetweencallCountFromandcallCountTotimes.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 576: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/576.jpg)
SyntaxC#
publicstaticTimesBetween(
intcallCountFrom,
intcallCountTo,
RangerangeKind
)
Parameters
callCountFromType:System..::..Int32Theminimunnumberoftimes.
callCountToType:System..::..Int32Themaximunnumberoftimes.
rangeKindType:Moq..::..RangeThekindofrange.SeeRange.
ReturnValue
Anobjectdefiningtheallowednumberofinvocations.
![Page 578: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/578.jpg)
C#
MoqTimes..::..EqualsMethodTimesStructureSeeAlsoSendFeedbackDetermineswhetherthespecifiedObjectisequaltothisinstance.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 579: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/579.jpg)
SyntaxC#
publicoverrideboolEquals(
Objectobj
)
Parameters
objType:System..::..ObjectTheObjecttocomparewiththisinstance.
ReturnValue
trueifthespecifiedObjectisequaltothisinstance;otherwise,false.
![Page 581: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/581.jpg)
C#
MoqTimes..::..ExactlyMethodTimesStructureSeeAlsoSendFeedbackSpecifiesthatamockedmethodshouldbeinvokedexactlycallCounttimes.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 582: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/582.jpg)
SyntaxC#
publicstaticTimesExactly(
intcallCount
)
Parameters
callCountType:System..::..Int32Thetimesthatamethodorpropertycanbecalled.
ReturnValue
Anobjectdefiningtheallowednumberofinvocations.
![Page 584: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/584.jpg)
C#
MoqTimes..::..GetHashCodeMethodTimesStructureSeeAlsoSendFeedbackReturnsahashcodeforthisinstance.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 585: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/585.jpg)
SyntaxC#
publicoverrideintGetHashCode()
ReturnValue
Ahashcodeforthisinstance,suitableforuseinhashingalgorithmsanddatastructureslikeahashtable.
![Page 587: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/587.jpg)
C#
MoqTimes..::..NeverMethodTimesStructureSeeAlsoSendFeedbackSpecifiesthatamockedmethodshouldnotbeinvoked.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 588: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/588.jpg)
SyntaxC#
publicstaticTimesNever()
ReturnValue
Anobjectdefiningtheallowednumberofinvocations.
![Page 590: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/590.jpg)
C#
MoqTimes..::..OnceMethodTimesStructureSeeAlsoSendFeedbackSpecifiesthatamockedmethodshouldbeinvokedexactlyonetime.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 591: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/591.jpg)
SyntaxC#
publicstaticTimesOnce()
ReturnValue
Anobjectdefiningtheallowednumberofinvocations.
![Page 593: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/593.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqTimesOperatorsTimesStructureSeeAlsoSendFeedback
TheTimestypeexposesthefollowingmembers.
![Page 594: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/594.jpg)
Operators Name Description
Equality DetermineswhethertwospecifiedTimesobjectshavethesamevalue.
Inequality DetermineswhethertwospecifiedTimesobjectshavedifferentvalues.
![Page 596: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/596.jpg)
C#
MoqTimes..::..EqualityOperatorTimesStructureSeeAlsoSendFeedbackDetermineswhethertwospecifiedTimesobjectshavethesamevalue.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 597: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/597.jpg)
SyntaxC#
publicstaticbooloperator==(
Timesleft,
Timesright
)
Parameters
leftType:Moq..::..TimesThefirstTimes.
rightType:Moq..::..TimesThesecondTimes.
ReturnValue
trueifthevalueofleftisthesameasthevalueofright;otherwise,false.
![Page 599: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/599.jpg)
C#
MoqTimes..::..InequalityOperatorTimesStructureSeeAlsoSendFeedbackDetermineswhethertwospecifiedTimesobjectshavedifferentvalues.
Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 600: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/600.jpg)
SyntaxC#
publicstaticbooloperator!=(
Timesleft,
Timesright
)
Parameters
leftType:Moq..::..TimesThefirstTimes.
rightType:Moq..::..TimesThesecondTimes.
ReturnValue
trueifthevalueofleftisdifferentfromthevalueofright;otherwise,false.
![Page 602: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/602.jpg)
C#
MoqMoq.LanguageNamespaceSendFeedbackThisnamespacedefinestheinterfacesthatcontainthemethodsavailableinMoqfluentAPI,suchasSetup,Callback,Returns,Throws,etc.
Reviewthedocumentationoftheavailablemethodsontheseinterfacesforcodeexamples.Thewaytheseinterfacesarecomposed,groupedandmadevisibleatdifferentstagesduringanexpectation(i.e.Verifiableisthelast"verb"andcan'tbespecifiedbeforetheReturns)isinternalbuttheAPIwillnaturallyleadyoutotheproperwayofusingit,sodon'tworrytoomuchaboutwho(andwhere)exposestheselanguageinterfaces.TheywillshowupinIntellisensewhenit'sappropriate.
Dousetheirdocumentationtolearnaboutoptions(especiallywhenthereareseveraloverloadsavailable)thatmaybeabetterfitforaparticularscenario.
![Page 603: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/603.jpg)
Interfaces Interface Description
ICallback DefinestheCallbackverbandoverloads.ICallback<(Of<(<'TMock,TResult>)>)>
DefinestheCallbackverbandoverloadsforcallbacksonsetupsthatreturnavalue.
ICallbackGetter<(Of<(<'TMock,TProperty>)>)>
DefinestheCallbackverbforpropertygettersetups.
ICallbackSetter<(Of<(<'TProperty>)>)>
DefinestheCallbackverbforpropertysettersetups.
IRaise<(Of<(<'T>)>)> DefinestheRaisesverb.IReturns<(Of<(<'TMock,TResult>)>)> DefinestheReturnsverb.
IReturnsGetter<(Of<(<'TMock,TProperty>)>)>
DefinestheReturnsverbforpropertygetsetups.
ISetupConditionResult<(Of<(<'T>)>)> ImplementsthefluentAPI.
ISetupSequentialResult<(Of<(<'TResult>)>)> LanguageforReturnSequence
IThrows DefinestheThrowsverb.IVerifies DefinestheVerifiableverb.
![Page 604: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/604.jpg)
C#
MoqICallbackInterfaceMembersSeeAlsoSendFeedbackDefinestheCallbackverbandoverloads.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 605: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/605.jpg)
SyntaxC#
publicinterfaceICallback:IHideObjectMembers
![Page 606: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/606.jpg)
SeeAlsoICallbackMembersMoq.LanguageNamespace
![Page 607: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/607.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallbackMembersICallbackInterfaceMethodsSeeAlsoSendFeedback
![Page 608: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/608.jpg)
Methods Name Description
Callback(Action)Specifiesacallbacktoinvokewhenthemethodiscalled.
Callback<(Of<<'(T>)>>)(Action<(Of<<'(T>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginal
![Page 609: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/609.jpg)
arguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2>)>>)(Action<(Of<(<'T1,T2>)>)>)Callback<(Of<<'(T1,T2,T3>)>>)(Action<(Of<(<'T1,T2,T3>)>)>)Callback<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<(<'T1,T2,T3,T4>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>)
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
![Page 610: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/610.jpg)
SeeAlsoICallbackInterfaceMoq.LanguageNamespace
![Page 611: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/611.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallbackMethodsICallbackInterfaceSeeAlsoSendFeedback
![Page 612: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/612.jpg)
Methods Name Description
Callback(Action)Specifiesacallbacktoinvokewhenthemethodiscalled.
Callback<(Of<<'(T>)>>)(Action<(Of<<'(T>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginal
![Page 613: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/613.jpg)
arguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2>)>>)(Action<(Of<(<'T1,T2>)>)>)Callback<(Of<<'(T1,T2,T3>)>>)(Action<(Of<(<'T1,T2,T3>)>)>)Callback<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<(<'T1,T2,T3,T4>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>)
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
![Page 614: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/614.jpg)
SeeAlsoICallbackInterfaceMoq.LanguageNamespace
![Page 615: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/615.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallback..::..CallbackMethodICallbackInterfaceSeeAlsoSendFeedback
![Page 616: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/616.jpg)
OverloadList Name Description
Callback(Action)Specifiesacallbacktoinvokewhenthemethodiscalled.
Callback<(Of<<'(T>)>>)(Action<(Of<<'(T>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginal
![Page 617: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/617.jpg)
arguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2>)>>)(Action<(Of<(<'T1,T2>)>)>)Callback<(Of<<'(T1,T2,T3>)>>)(Action<(Of<(<'T1,T2,T3>)>)>)Callback<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<(<'T1,T2,T3,T4>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>)
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
![Page 618: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/618.jpg)
SeeAlsoICallbackInterfaceICallbackMembersMoq.LanguageNamespace
![Page 619: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/619.jpg)
C#
MoqICallback..::..CallbackMethod(Action)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalled.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 620: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/620.jpg)
SyntaxC#
ICallbackResultCallback(
Actionaction
)
Parameters
actionType:System..::..ActionThecallbackmethodtoinvoke.
![Page 621: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/621.jpg)
Copy
ExamplesThefollowingexamplespecifiesacallbacktosetabooleanvaluethatcanbeusedlater:
C#
varcalled=false;
mock.Setup(x=>x.Execute())
.Callback(()=>called=true);
![Page 622: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/622.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 623: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/623.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T>)>)>Method(Action<(Of<(<'T>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 624: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/624.jpg)
SyntaxC#
ICallbackResultCallback<T>(
Action<T>action
)
Parameters
actionType:System..::..Action<(Of<(<'T>)>)>Thecallbackmethodtoinvoke.
![Page 625: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/625.jpg)
TypeParametersT
Theargumenttypeoftheinvokedmethod.
![Page 626: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/626.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentvalue.
Noticehowthespecificstringargumentisretrievedbysimplydeclaringitaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(It.IsAny<string>()))
.Callback((stringcommand)=>Console.WriteLine(command));
![Page 627: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/627.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 628: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/628.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 629: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/629.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>action
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>)>Thecallbackmethodtoinvoke.
![Page 630: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/630.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.
ReturnValue
AreferencetoICallbackResultinterface.
![Page 631: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/631.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 632: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/632.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 633: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/633.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 634: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/634.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>action
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>)>Thecallbackmethodtoinvoke.
![Page 635: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/635.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.
ReturnValue
AreferencetoICallbackResultinterface.
![Page 636: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/636.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 637: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/637.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 638: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/638.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 639: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/639.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>action
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>)>Thecallbackmethodtoinvoke.
![Page 640: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/640.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.
ReturnValue
AreferencetoICallbackResultinterface.
![Page 641: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/641.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 642: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/642.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 643: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/643.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 644: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/644.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>)>Thecallbackmethodtoinvoke.
![Page 645: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/645.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.
ReturnValue
AreferencetoICallbackResultinterface.
![Page 646: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/646.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 647: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/647.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 648: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/648.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 649: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/649.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>)>Thecallbackmethodtoinvoke.
![Page 650: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/650.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.
ReturnValue
AreferencetoICallbackResultinterface.
![Page 651: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/651.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 652: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/652.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 653: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/653.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 654: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/654.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>)>Thecallbackmethodtoinvoke.
![Page 655: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/655.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.T15
Thetypeofthefifteenthargumentoftheinvokedmethod.
ReturnValue
AreferencetoICallbackResultinterface.
![Page 656: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/656.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 657: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/657.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 658: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/658.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 659: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/659.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>)>Thecallbackmethodtoinvoke.
![Page 660: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/660.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.T15
Thetypeofthefifteenthargumentoftheinvokedmethod.T16
Thetypeofthesixteenthargumentoftheinvokedmethod.
ReturnValue
![Page 661: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/661.jpg)
AreferencetoICallbackResultinterface.
![Page 662: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/662.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 663: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/663.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 664: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/664.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2>)>)>Method(Action)ICallbackInterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback.Callback``2(System.Action`2)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 665: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/665.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2>)>)>
![Page 666: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/666.jpg)
TypeParametersT1T2
![Page 667: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/667.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 668: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/668.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3>)>)>Method(Action)ICallbackInterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback.Callback``3(System.Action`3)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 669: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/669.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3>)>)>
![Page 670: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/670.jpg)
TypeParametersT1T2T3
![Page 671: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/671.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 672: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/672.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4>)>)>Method(Action)ICallbackInterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback.Callback``4(System.Action`4)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 673: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/673.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4>)>)>
![Page 674: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/674.jpg)
TypeParametersT1T2T3T4
![Page 675: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/675.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 676: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/676.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5>)>)>Method(Action)ICallbackInterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback.Callback``5(System.Action`5)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 677: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/677.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5>)>)>
![Page 678: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/678.jpg)
TypeParametersT1T2T3T4T5
![Page 679: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/679.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 680: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/680.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>Method(Action)ICallbackInterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback.Callback``6(System.Action`6)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 681: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/681.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>
![Page 682: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/682.jpg)
TypeParametersT1T2T3T4T5T6
![Page 683: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/683.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 684: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/684.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>Method(Action)ICallbackInterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback.Callback``7(System.Action`7)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 685: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/685.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>
![Page 686: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/686.jpg)
TypeParametersT1T2T3T4T5T6T7
![Page 687: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/687.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 688: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/688.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>Method(Action)ICallbackInterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback.Callback``8(System.Action`8)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 689: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/689.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>
![Page 690: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/690.jpg)
TypeParametersT1T2T3T4T5T6T7T8
![Page 691: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/691.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 692: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/692.jpg)
C#
MoqICallback..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9>)>)>)ICallbackInterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 693: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/693.jpg)
SyntaxC#
ICallbackResultCallback<T1,T2,T3,T4,T5,T6,T7,T8,T9>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9>action
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9>)>)>Thecallbackmethodtoinvoke.
![Page 694: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/694.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.
ReturnValue
AreferencetoICallbackResultinterface.
![Page 695: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/695.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 696: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/696.jpg)
SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace
![Page 697: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/697.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>InterfaceMembersSeeAlsoSendFeedbackDefinestheCallbackverbandoverloadsforcallbacksonsetupsthatreturnavalue.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 698: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/698.jpg)
SyntaxC#
publicinterfaceICallback<TMock,TResult>:IHideObjectMembers
whereTMock:class
![Page 699: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/699.jpg)
TypeParametersTMock
Mockedtype.TResult
Typeofthereturnvalueofthesetup.
![Page 700: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/700.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>MembersMoq.LanguageNamespace
![Page 701: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/701.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallback<(Of<(<'TMock,TResult>)>)>MembersICallback<(Of<(<'TMock,TResult>)>)>InterfaceMethodsSeeAlsoSendFeedback
![Page 702: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/702.jpg)
Methods Name Description
Callback(Action)Specifiesacallbacktoinvokewhenthemethodiscalled.
Callback<(Of<<'(T>)>>)(Action<(Of<<'(T>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginal
![Page 703: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/703.jpg)
arguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2>)>>)(Action<(Of<(<'T1,T2>)>)>)Callback<(Of<<'(T1,T2,T3>)>>)(Action<(Of<(<'T1,T2,T3>)>)>)Callback<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<(<'T1,T2,T3,T4>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>)
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
![Page 704: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/704.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceMoq.LanguageNamespace
![Page 705: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/705.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallback<(Of<(<'TMock,TResult>)>)>MethodsICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
![Page 706: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/706.jpg)
Methods Name Description
Callback(Action)Specifiesacallbacktoinvokewhenthemethodiscalled.
Callback<(Of<<'(T>)>>)(Action<(Of<<'(T>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginal
![Page 707: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/707.jpg)
arguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2>)>>)(Action<(Of<(<'T1,T2>)>)>)Callback<(Of<<'(T1,T2,T3>)>>)(Action<(Of<(<'T1,T2,T3>)>)>)Callback<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<(<'T1,T2,T3,T4>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>)
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
![Page 708: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/708.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceMoq.LanguageNamespace
![Page 709: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/709.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..CallbackMethodICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
![Page 710: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/710.jpg)
OverloadList Name Description
Callback(Action)Specifiesacallbacktoinvokewhenthemethodiscalled.
Callback<(Of<<'(T>)>>)(Action<(Of<<'(T>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginal
![Page 711: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/711.jpg)
arguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Callback<(Of<<'(T1,T2>)>>)(Action<(Of<(<'T1,T2>)>)>)Callback<(Of<<'(T1,T2,T3>)>>)(Action<(Of<(<'T1,T2,T3>)>)>)Callback<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<(<'T1,T2,T3,T4>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>)Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>)
Callback<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>))
Specifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
![Page 712: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/712.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceICallback<(Of<(<'TMock,TResult>)>)>MembersMoq.LanguageNamespace
![Page 713: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/713.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..CallbackMethod(Action)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalled.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 714: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/714.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback(
Actionaction
)
Parameters
actionType:System..::..ActionThecallbackmethodtoinvoke.
![Page 715: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/715.jpg)
Copy
ExamplesThefollowingexamplespecifiesacallbacktosetabooleanvaluethatcanbeusedlater:
C#
varcalled=false;
mock.Setup(x=>x.Execute())
.Callback(()=>called=true)
.Returns(true);
Notethatinthecaseofvalue-returningmethods,aftertheCallbackcallyoucanstillspecifythereturnvalue.
![Page 716: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/716.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 717: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/717.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T>)>)>Method(Action<(Of<(<'T>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 718: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/718.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T>(
Action<T>action
)
Parameters
actionType:System..::..Action<(Of<(<'T>)>)>Callbackmethodtoinvoke.
![Page 719: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/719.jpg)
TypeParametersT
Thetypeoftheargumentoftheinvokedmethod.
![Page 720: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/720.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentvalue.
Noticehowthespecificstringargumentisretrievedbysimplydeclaringitaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(It.IsAny<string>()))
.Callback(command=>Console.WriteLine(command))
.Returns(true);
![Page 721: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/721.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 722: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/722.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 723: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/723.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>action
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>)>Thecallbackmethodtoinvoke.
![Page 724: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/724.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.
ReturnValue
AreferencetoIReturnsThrowsinterface.
![Page 725: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/725.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)=>Console.WriteLine(arg1+arg2+arg3+arg4+arg5+arg6+arg7+arg8+arg9+arg10));
![Page 726: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/726.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 727: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/727.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 728: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/728.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>action
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>)>Thecallbackmethodtoinvoke.
![Page 729: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/729.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.
ReturnValue
AreferencetoIReturnsThrowsinterface.
![Page 730: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/730.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)=>Console.WriteLine(arg1+arg2+arg3+arg4+arg5+arg6+arg7+arg8+arg9+arg10+arg11));
![Page 731: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/731.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 732: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/732.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 733: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/733.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>action
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>)>Thecallbackmethodtoinvoke.
![Page 734: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/734.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.
ReturnValue
AreferencetoIReturnsThrowsinterface.
![Page 735: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/735.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12)=>Console.WriteLine(arg1+arg2+arg3+arg4+arg5+arg6+arg7+arg8+arg9+arg10+arg11+arg12));
![Page 736: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/736.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 737: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/737.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 738: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/738.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>)>Thecallbackmethodtoinvoke.
![Page 739: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/739.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.
ReturnValue
AreferencetoIReturnsThrowsinterface.
![Page 740: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/740.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13)=>Console.WriteLine(arg1+arg2+arg3+arg4+arg5+arg6+arg7+arg8+arg9+arg10+arg11+arg12+arg13));
![Page 741: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/741.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 742: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/742.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 743: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/743.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>)>Thecallbackmethodtoinvoke.
![Page 744: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/744.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.
ReturnValue
AreferencetoIReturnsThrowsinterface.
![Page 745: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/745.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14)=>Console.WriteLine(arg1+arg2+arg3+arg4+arg5+arg6+arg7+arg8+arg9+arg10+arg11+arg12+arg13+arg14));
![Page 746: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/746.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 747: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/747.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 748: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/748.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>)>Thecallbackmethodtoinvoke.
![Page 749: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/749.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.T15
Thetypeofthefifteenthargumentoftheinvokedmethod.
ReturnValue
AreferencetoIReturnsThrowsinterface.
![Page 750: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/750.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15)=>Console.WriteLine(arg1+arg2+arg3+arg4+arg5+arg6+arg7+arg8+arg9+arg10+arg11+arg12+arg13+arg14+arg15));
![Page 751: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/751.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 752: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/752.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 753: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/753.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>)>Thecallbackmethodtoinvoke.
![Page 754: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/754.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.T15
Thetypeofthefifteenthargumentoftheinvokedmethod.T16
Thetypeofthesixteenthargumentoftheinvokedmethod.
ReturnValue
![Page 755: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/755.jpg)
AreferencetoIReturnsThrowsinterface.
![Page 756: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/756.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16)=>Console.WriteLine(arg1+arg2+arg3+arg4+arg5+arg6+arg7+arg8+arg9+arg10+arg11+arg12+arg13+arg14+arg15+arg16));
![Page 757: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/757.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 758: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/758.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2>)>)>Method(Action)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback`2.Callback``2(System.Action`2)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 759: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/759.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2>)>)>
![Page 760: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/760.jpg)
TypeParametersT1T2
![Page 761: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/761.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 762: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/762.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3>)>)>Method(Action)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback`2.Callback``3(System.Action`3)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 763: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/763.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3>)>)>
![Page 764: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/764.jpg)
TypeParametersT1T2T3
![Page 765: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/765.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 766: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/766.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4>)>)>Method(Action)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback`2.Callback``4(System.Action`4)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 767: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/767.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4>)>)>
![Page 768: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/768.jpg)
TypeParametersT1T2T3T4
![Page 769: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/769.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 770: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/770.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5>)>)>Method(Action)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback`2.Callback``5(System.Action`5)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 771: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/771.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5>)>)>
![Page 772: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/772.jpg)
TypeParametersT1T2T3T4T5
![Page 773: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/773.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 774: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/774.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>Method(Action)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback`2.Callback``6(System.Action`6)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 775: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/775.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>
![Page 776: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/776.jpg)
TypeParametersT1T2T3T4T5T6
![Page 777: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/777.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 778: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/778.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>Method(Action)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback`2.Callback``7(System.Action`7)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 779: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/779.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>
![Page 780: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/780.jpg)
TypeParametersT1T2T3T4T5T6T7
![Page 781: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/781.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 782: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/782.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>Method(Action)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ICallback`2.Callback``8(System.Action`8)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 783: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/783.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8>(
Actionaction
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>
![Page 784: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/784.jpg)
TypeParametersT1T2T3T4T5T6T7T8
![Page 785: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/785.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 786: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/786.jpg)
C#
MoqICallback<(Of<(<'TMock,TResult>)>)>..::..Callback<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9>)>)>Method(Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9>)>)>)ICallback<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthemethodiscalledthatreceivestheoriginalarguments.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 787: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/787.jpg)
SyntaxC#
IReturnsThrows<TMock,TResult>Callback<T1,T2,T3,T4,T5,T6,T7,T8,T9>(
Action<T1,T2,T3,T4,T5,T6,T7,T8,T9>action
)
Parameters
actionType:System..::..Action<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9>)>)>Thecallbackmethodtoinvoke.
![Page 788: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/788.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.
ReturnValue
AreferencetoIReturnsThrowsinterface.
![Page 789: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/789.jpg)
Copy
ExamplesInvokesthegivencallbackwiththeconcreteinvocationargumentsvalues.
Noticehowthespecificargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpressionforthecallback:
C#
mock.Setup(x=>x.Execute(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>()))
.Callback((arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)=>Console.WriteLine(arg1+arg2+arg3+arg4+arg5+arg6+arg7+arg8+arg9));
![Page 790: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/790.jpg)
SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace
![Page 791: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/791.jpg)
C#
MoqICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMembersSeeAlsoSendFeedbackDefinestheCallbackverbforpropertygettersetups.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 792: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/792.jpg)
SyntaxC#
publicinterfaceICallbackGetter<TMock,TProperty>:IHideObjectMembers
whereTMock:class
![Page 793: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/793.jpg)
TypeParametersTMock
Mockedtype.TProperty
Typeoftheproperty.
![Page 794: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/794.jpg)
SeeAlsoICallbackGetter<(Of<(<'TMock,TProperty>)>)>MembersMoq.LanguageNamespaceMockSetupGet``1(Expression<(Of<<'(Func<(Of<<'(UTP,UMP>)>>)>)>>))
![Page 795: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/795.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallbackGetter<(Of<(<'TMock,TProperty>)>)>MembersICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMethodsSeeAlsoSendFeedback
TheICallbackGetter<(Of<(<'TMock,TProperty>)>)>typeexposesthefollowingmembers.
![Page 796: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/796.jpg)
Methods Name Description
Callback Specifiesacallbacktoinvokewhenthepropertyisretrieved.
![Page 797: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/797.jpg)
SeeAlsoICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace
![Page 798: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/798.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallbackGetter<(Of<(<'TMock,TProperty>)>)>MethodsICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceSeeAlsoSendFeedback
TheICallbackGetter<(Of<(<'TMock,TProperty>)>)>typeexposesthefollowingmembers.
![Page 799: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/799.jpg)
Methods Name Description
Callback Specifiesacallbacktoinvokewhenthepropertyisretrieved.
![Page 800: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/800.jpg)
SeeAlsoICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace
![Page 801: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/801.jpg)
C#
MoqICallbackGetter<(Of<(<'TMock,TProperty>)>)>..::..CallbackMethodICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthepropertyisretrieved.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 802: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/802.jpg)
SyntaxC#
IReturnsThrowsGetter<TMock,TProperty>Callback(
Actionaction
)
Parameters
actionType:System..::..ActionCallbackmethodtoinvoke.
![Page 803: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/803.jpg)
Copy
ExamplesInvokesthegivencallbackwiththepropertyvaluebeingset.
C#
mock.SetupGet(x=>x.Suspended)
.Callback(()=>called=true)
.Returns(true);
![Page 804: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/804.jpg)
SeeAlsoICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace
![Page 805: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/805.jpg)
C#
MoqICallbackSetter<(Of<(<'TProperty>)>)>InterfaceMembersSeeAlsoSendFeedbackDefinestheCallbackverbforpropertysettersetups.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 806: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/806.jpg)
SyntaxC#
publicinterfaceICallbackSetter<TProperty>:IHideObjectMembers
![Page 807: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/807.jpg)
TypeParametersTProperty
Typeoftheproperty.
![Page 808: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/808.jpg)
SeeAlsoICallbackSetter<(Of<(<'TProperty>)>)>MembersMoq.LanguageNamespace
![Page 809: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/809.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallbackSetter<(Of<(<'TProperty>)>)>MembersICallbackSetter<(Of<(<'TProperty>)>)>InterfaceMethodsSeeAlsoSendFeedback
TheICallbackSetter<(Of<(<'TProperty>)>)>typeexposesthefollowingmembers.
![Page 810: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/810.jpg)
Methods Name Description
Callback Specifiesacallbacktoinvokewhenthepropertyissetthatreceivesthepropertyvaluebeingset.
![Page 811: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/811.jpg)
SeeAlsoICallbackSetter<(Of<(<'TProperty>)>)>InterfaceMoq.LanguageNamespace
![Page 812: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/812.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqICallbackSetter<(Of<(<'TProperty>)>)>MethodsICallbackSetter<(Of<(<'TProperty>)>)>InterfaceSeeAlsoSendFeedback
TheICallbackSetter<(Of<(<'TProperty>)>)>typeexposesthefollowingmembers.
![Page 813: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/813.jpg)
Methods Name Description
Callback Specifiesacallbacktoinvokewhenthepropertyissetthatreceivesthepropertyvaluebeingset.
![Page 814: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/814.jpg)
SeeAlsoICallbackSetter<(Of<(<'TProperty>)>)>InterfaceMoq.LanguageNamespace
![Page 815: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/815.jpg)
C#
MoqICallbackSetter<(Of<(<'TProperty>)>)>..::..CallbackMethodICallbackSetter<(Of<(<'TProperty>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesacallbacktoinvokewhenthepropertyissetthatreceivesthepropertyvaluebeingset.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 816: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/816.jpg)
SyntaxC#
ICallbackResultCallback(
Action<TProperty>action
)
Parameters
actionType:System..::..Action<(Of<(<'TProperty>)>)>Callbackmethodtoinvoke.
![Page 817: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/817.jpg)
Copy
ExamplesInvokesthegivencallbackwiththepropertyvaluebeingset.
C#
mock.SetupSet(x=>x.Suspended)
.Callback((boolstate)=>Console.WriteLine(state));
![Page 818: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/818.jpg)
SeeAlsoICallbackSetter<(Of<(<'TProperty>)>)>InterfaceMoq.LanguageNamespace
![Page 819: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/819.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>InterfaceMembersSeeAlsoSendFeedbackDefinestheRaisesverb.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 820: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/820.jpg)
SyntaxC#
publicinterfaceIRaise<T>:IHideObjectMembers
![Page 821: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/821.jpg)
TypeParametersT
![Page 822: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/822.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>MembersMoq.LanguageNamespace
![Page 823: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/823.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIRaise<(Of<(<'T>)>)>MembersIRaise<(Of<(<'T>)>)>InterfaceMethodsSeeAlsoSendFeedback
![Page 824: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/824.jpg)
Methods Name Description
Raises(Action<(Of<<'(T>)>>),EventArgs)
Specifiestheeventthatwillberaisedwhenthesetupismet.
Raises(Action<(Of<<'(T>)>>),Func<(Of<(<'TResult>)>)>)
Raises(Action<(Of<<'(T>)>>),array<Object>[]()[][])
Specifiesthecustomeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of Specifiesthe
![Page 825: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/825.jpg)
<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,EventArgs>)>>))
eventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,TResult>)>)>)Raises<(Of<<'(T1,T2,T3>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,TResult>)>)>)
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
![Page 826: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/826.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace
![Page 827: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/827.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIRaise<(Of<(<'T>)>)>MethodsIRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
![Page 828: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/828.jpg)
Methods Name Description
Raises(Action<(Of<<'(T>)>>),EventArgs)
Specifiestheeventthatwillberaisedwhenthesetupismet.
Raises(Action<(Of<<'(T>)>>),Func<(Of<(<'TResult>)>)>)
Raises(Action<(Of<<'(T>)>>),array<Object>[]()[][])
Specifiesthecustomeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of Specifiesthe
![Page 829: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/829.jpg)
<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,EventArgs>)>>))
eventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,TResult>)>)>)Raises<(Of<<'(T1,T2,T3>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,TResult>)>)>)
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
![Page 830: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/830.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace
![Page 831: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/831.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIRaise<(Of<(<'T>)>)>..::..RaisesMethodIRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
![Page 832: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/832.jpg)
OverloadList Name Description
Raises(Action<(Of<<'(T>)>>),EventArgs)
Specifiestheeventthatwillberaisedwhenthesetupismet.
Raises(Action<(Of<<'(T>)>>),Func<(Of<(<'TResult>)>)>)
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
![Page 833: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/833.jpg)
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Action<(Of<<'(T>)>>),Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,EventArgs>)>>))
Specifiestheeventthatwillberaisedwhenthesetupismatched.
Raises<(Of<<'(T1>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T,TResult>)>)>)Raises<(Of<<'(T1,T2>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,TResult>)>)>)Raises<(Of<<'(T1,T2,T3>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,TResult>)>)>)Raises<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Action<(Of<<'(T>)>>),Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,TResult>)>)>)
Raises(Action<(Of<<'(T>)>>),array<Object>[]()[][])
Specifiesthecustomeventthatwillberaisedwhenthesetupismatched.
![Page 834: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/834.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceIRaise<(Of<(<'T>)>)>MembersMoq.LanguageNamespace
![Page 835: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/835.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..RaisesMethod(Action<(Of<(<'T>)>)>,EventArgs)IRaise<(Of<(<'T>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismet.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 836: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/836.jpg)
SyntaxC#
IVerifiesRaises(
Action<T>eventExpression,
EventArgsargs
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Anexpressionthatrepresentsaneventattachordetachaction.
argsType:System..::..EventArgsTheeventargumentstopassfortheraisedevent.
![Page 837: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/837.jpg)
Copy
ExamplesThefollowingexampleshowshowtoraiseaneventwhenthesetupismet:
C#
varmock=newMock<IContainer>();
mock.Setup(add=>add.Add(It.IsAny<string>(),It.IsAny<object>()))
.Raises(add=>add.Added+=null,EventArgs.Empty);
![Page 838: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/838.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 839: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/839.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..RaisesMethod(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.Func`1)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 840: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/840.jpg)
SyntaxC#
IVerifiesRaises(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'TResult>)>)>
![Page 841: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/841.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 842: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/842.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9>)>)>Method(Action<(Of<(<'T>)>)>,Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,EventArgs>)>)>)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 843: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/843.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8,T9>(
Action<T>eventExpression,
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,EventArgs>func
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Theexpressionthatrepresentsaneventattachordetachaction.
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,EventArgs>)>)>ThefunctionthatwillbuildtheEventArgstopasswhenraisingtheevent.
![Page 844: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/844.jpg)
TypeParametersT1
Thetypeofthefirstargumentreceivedbytheexpectedinvocation.T2
Thetypeofthesecondargumentreceivedbytheexpectedinvocation.T3
Thetypeofthethirdargumentreceivedbytheexpectedinvocation.T4
Thetypeofthefourthargumentreceivedbytheexpectedinvocation.T5
Thetypeofthefifthargumentreceivedbytheexpectedinvocation.T6
Thetypeofthesixthargumentreceivedbytheexpectedinvocation.T7
Thetypeoftheseventhargumentreceivedbytheexpectedinvocation.T8
Thetypeoftheeighthargumentreceivedbytheexpectedinvocation.T9
Thetypeoftheninethargumentreceivedbytheexpectedinvocation.
![Page 845: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/845.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)
![Page 846: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/846.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>)>Method(Action<(Of<(<'T>)>)>,Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,EventArgs>)>)>)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 847: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/847.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(
Action<T>eventExpression,
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,EventArgs>func
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Theexpressionthatrepresentsaneventattachordetachaction.
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,EventArgs>)>)>ThefunctionthatwillbuildtheEventArgstopasswhenraisingtheevent.
![Page 848: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/848.jpg)
TypeParametersT1
Thetypeofthefirstargumentreceivedbytheexpectedinvocation.T2
Thetypeofthesecondargumentreceivedbytheexpectedinvocation.T3
Thetypeofthethirdargumentreceivedbytheexpectedinvocation.T4
Thetypeofthefourthargumentreceivedbytheexpectedinvocation.T5
Thetypeofthefifthargumentreceivedbytheexpectedinvocation.T6
Thetypeofthesixthargumentreceivedbytheexpectedinvocation.T7
Thetypeoftheseventhargumentreceivedbytheexpectedinvocation.T8
Thetypeoftheeighthargumentreceivedbytheexpectedinvocation.T9
Thetypeoftheninethargumentreceivedbytheexpectedinvocation.T10
Thetypeofthetenthargumentreceivedbytheexpectedinvocation.
![Page 849: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/849.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)
![Page 850: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/850.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>)>Method(Action<(Of<(<'T>)>)>,Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,EventArgs>)>)>)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 851: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/851.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(
Action<T>eventExpression,
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,EventArgs
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Theexpressionthatrepresentsaneventattachordetachaction.
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,EventArgs>)>)>ThefunctionthatwillbuildtheEventArgstopasswhenraisingtheevent.
![Page 852: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/852.jpg)
TypeParametersT1
Thetypeofthefirstargumentreceivedbytheexpectedinvocation.T2
Thetypeofthesecondargumentreceivedbytheexpectedinvocation.T3
Thetypeofthethirdargumentreceivedbytheexpectedinvocation.T4
Thetypeofthefourthargumentreceivedbytheexpectedinvocation.T5
Thetypeofthefifthargumentreceivedbytheexpectedinvocation.T6
Thetypeofthesixthargumentreceivedbytheexpectedinvocation.T7
Thetypeoftheseventhargumentreceivedbytheexpectedinvocation.T8
Thetypeoftheeighthargumentreceivedbytheexpectedinvocation.T9
Thetypeoftheninethargumentreceivedbytheexpectedinvocation.T10
Thetypeofthetenthargumentreceivedbytheexpectedinvocation.T11
Thetypeoftheeleventhargumentreceivedbytheexpectedinvocation.
![Page 853: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/853.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)
![Page 854: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/854.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>)>Method(Action<(Of<(<'T>)>)>,Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,EventArgs>)>)>)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 855: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/855.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(
Action<T>eventExpression,
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,EventArgs
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Theexpressionthatrepresentsaneventattachordetachaction.
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,EventArgs>)>)>ThefunctionthatwillbuildtheEventArgstopasswhenraisingtheevent.
![Page 856: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/856.jpg)
TypeParametersT1
Thetypeofthefirstargumentreceivedbytheexpectedinvocation.T2
Thetypeofthesecondargumentreceivedbytheexpectedinvocation.T3
Thetypeofthethirdargumentreceivedbytheexpectedinvocation.T4
Thetypeofthefourthargumentreceivedbytheexpectedinvocation.T5
Thetypeofthefifthargumentreceivedbytheexpectedinvocation.T6
Thetypeofthesixthargumentreceivedbytheexpectedinvocation.T7
Thetypeoftheseventhargumentreceivedbytheexpectedinvocation.T8
Thetypeoftheeighthargumentreceivedbytheexpectedinvocation.T9
Thetypeoftheninethargumentreceivedbytheexpectedinvocation.T10
Thetypeofthetenthargumentreceivedbytheexpectedinvocation.T11
Thetypeoftheeleventhargumentreceivedbytheexpectedinvocation.T12
Thetypeofthetwelfthargumentreceivedbytheexpectedinvocation.
![Page 857: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/857.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)
![Page 858: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/858.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>)>Method(Action<(Of<(<'T>)>)>,Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,EventArgs>)>)>)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 859: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/859.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(
Action<T>eventExpression,
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Theexpressionthatrepresentsaneventattachordetachaction.
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,EventArgs>)>)>ThefunctionthatwillbuildtheEventArgstopasswhenraisingtheevent.
![Page 860: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/860.jpg)
TypeParametersT1
Thetypeofthefirstargumentreceivedbytheexpectedinvocation.T2
Thetypeofthesecondargumentreceivedbytheexpectedinvocation.T3
Thetypeofthethirdargumentreceivedbytheexpectedinvocation.T4
Thetypeofthefourthargumentreceivedbytheexpectedinvocation.T5
Thetypeofthefifthargumentreceivedbytheexpectedinvocation.T6
Thetypeofthesixthargumentreceivedbytheexpectedinvocation.T7
Thetypeoftheseventhargumentreceivedbytheexpectedinvocation.T8
Thetypeoftheeighthargumentreceivedbytheexpectedinvocation.T9
Thetypeoftheninethargumentreceivedbytheexpectedinvocation.T10
Thetypeofthetenthargumentreceivedbytheexpectedinvocation.T11
Thetypeoftheeleventhargumentreceivedbytheexpectedinvocation.T12
Thetypeofthetwelfthargumentreceivedbytheexpectedinvocation.T13
Thetypeofthethirteenthargumentreceivedbytheexpectedinvocation.
![Page 861: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/861.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)
![Page 862: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/862.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>)>Method(Action<(Of<(<'T>)>)>,Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,EventArgs>)>)>)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 863: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/863.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(
Action<T>eventExpression,
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Theexpressionthatrepresentsaneventattachordetachaction.
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,EventArgs>)>)>ThefunctionthatwillbuildtheEventArgstopasswhenraisingtheevent.
![Page 864: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/864.jpg)
TypeParametersT1
Thetypeofthefirstargumentreceivedbytheexpectedinvocation.T2
Thetypeofthesecondargumentreceivedbytheexpectedinvocation.T3
Thetypeofthethirdargumentreceivedbytheexpectedinvocation.T4
Thetypeofthefourthargumentreceivedbytheexpectedinvocation.T5
Thetypeofthefifthargumentreceivedbytheexpectedinvocation.T6
Thetypeofthesixthargumentreceivedbytheexpectedinvocation.T7
Thetypeoftheseventhargumentreceivedbytheexpectedinvocation.T8
Thetypeoftheeighthargumentreceivedbytheexpectedinvocation.T9
Thetypeoftheninethargumentreceivedbytheexpectedinvocation.T10
Thetypeofthetenthargumentreceivedbytheexpectedinvocation.T11
Thetypeoftheeleventhargumentreceivedbytheexpectedinvocation.T12
Thetypeofthetwelfthargumentreceivedbytheexpectedinvocation.T13
Thetypeofthethirteenthargumentreceivedbytheexpectedinvocation.T14
Thetypeofthefourteenthargumentreceivedbytheexpectedinvocation.
![Page 865: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/865.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)
![Page 866: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/866.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>)>Method(Action<(Of<(<'T>)>)>,Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,EventArgs>)>)>)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 867: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/867.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(
Action<T>eventExpression,
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Theexpressionthatrepresentsaneventattachordetachaction.
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,EventArgs>)>)>ThefunctionthatwillbuildtheEventArgstopasswhenraisingtheevent.
![Page 868: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/868.jpg)
TypeParametersT1
Thetypeofthefirstargumentreceivedbytheexpectedinvocation.T2
Thetypeofthesecondargumentreceivedbytheexpectedinvocation.T3
Thetypeofthethirdargumentreceivedbytheexpectedinvocation.T4
Thetypeofthefourthargumentreceivedbytheexpectedinvocation.T5
Thetypeofthefifthargumentreceivedbytheexpectedinvocation.T6
Thetypeofthesixthargumentreceivedbytheexpectedinvocation.T7
Thetypeoftheseventhargumentreceivedbytheexpectedinvocation.T8
Thetypeoftheeighthargumentreceivedbytheexpectedinvocation.T9
Thetypeoftheninethargumentreceivedbytheexpectedinvocation.T10
Thetypeofthetenthargumentreceivedbytheexpectedinvocation.T11
Thetypeoftheeleventhargumentreceivedbytheexpectedinvocation.T12
Thetypeofthetwelfthargumentreceivedbytheexpectedinvocation.T13
Thetypeofthethirteenthargumentreceivedbytheexpectedinvocation.T14
Thetypeofthefourteenthargumentreceivedbytheexpectedinvocation.T15
Thetypeofthefifteenthargumentreceivedbytheexpectedinvocation.
![Page 869: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/869.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)
![Page 870: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/870.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>)>Method(Action<(Of<(<'T>)>)>,Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,EventArgs>)>)>)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiestheeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 871: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/871.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(
Action<T>eventExpression,
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Theexpressionthatrepresentsaneventattachordetachaction.
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,EventArgs>)>)>ThefunctionthatwillbuildtheEventArgstopasswhenraisingtheevent.
![Page 872: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/872.jpg)
TypeParametersT1
Thetypeofthefirstargumentreceivedbytheexpectedinvocation.T2
Thetypeofthesecondargumentreceivedbytheexpectedinvocation.T3
Thetypeofthethirdargumentreceivedbytheexpectedinvocation.T4
Thetypeofthefourthargumentreceivedbytheexpectedinvocation.T5
Thetypeofthefifthargumentreceivedbytheexpectedinvocation.T6
Thetypeofthesixthargumentreceivedbytheexpectedinvocation.T7
Thetypeoftheseventhargumentreceivedbytheexpectedinvocation.T8
Thetypeoftheeighthargumentreceivedbytheexpectedinvocation.T9
Thetypeoftheninethargumentreceivedbytheexpectedinvocation.T10
Thetypeofthetenthargumentreceivedbytheexpectedinvocation.T11
Thetypeoftheeleventhargumentreceivedbytheexpectedinvocation.T12
Thetypeofthetwelfthargumentreceivedbytheexpectedinvocation.T13
Thetypeofthethirteenthargumentreceivedbytheexpectedinvocation.T14
Thetypeofthefourteenthargumentreceivedbytheexpectedinvocation.T15
Thetypeofthefifteenthargumentreceivedbytheexpectedinvocation.T16
Thetypeofthesixteenthargumentreceivedbytheexpectedinvocation.
![Page 873: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/873.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)
![Page 874: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/874.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1>)>)>Method(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises``1(System.Action{`0},System.Func`2)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 875: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/875.jpg)
SyntaxC#
IVerifiesRaises<T1>(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'T,TResult>)>)>
![Page 876: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/876.jpg)
TypeParametersT1
![Page 877: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/877.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 878: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/878.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2>)>)>Method(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises``2(System.Action{`0},System.Func`3)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 879: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/879.jpg)
SyntaxC#
IVerifiesRaises<T1,T2>(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'T1,T2,TResult>)>)>
![Page 880: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/880.jpg)
TypeParametersT1T2
![Page 881: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/881.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 882: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/882.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3>)>)>Method(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises``3(System.Action{`0},System.Func`4)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 883: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/883.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3>(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'T1,T2,T3,TResult>)>)>
![Page 884: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/884.jpg)
TypeParametersT1T2T3
![Page 885: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/885.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 886: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/886.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4>)>)>Method(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises``4(System.Action{`0},System.Func`5)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 887: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/887.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4>(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,TResult>)>)>
![Page 888: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/888.jpg)
TypeParametersT1T2T3T4
![Page 889: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/889.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 890: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/890.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5>)>)>Method(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises``5(System.Action{`0},System.Func`6)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 891: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/891.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5>(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,TResult>)>)>
![Page 892: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/892.jpg)
TypeParametersT1T2T3T4T5
![Page 893: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/893.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 894: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/894.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>Method(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises``6(System.Action{`0},System.Func`7)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 895: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/895.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6>(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,TResult>)>)>
![Page 896: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/896.jpg)
TypeParametersT1T2T3T4T5T6
![Page 897: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/897.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 898: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/898.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>Method(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises``7(System.Action{`0},System.Func`8)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 899: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/899.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7>(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,TResult>)>)>
![Page 900: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/900.jpg)
TypeParametersT1T2T3T4T5T6T7
![Page 901: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/901.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 902: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/902.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..Raises<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>Method(Action<(Of<(<'T>)>)>,Func)IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IRaise`1.Raises``8(System.Action{`0},System.Func`9)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 903: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/903.jpg)
SyntaxC#
IVerifiesRaises<T1,T2,T3,T4,T5,T6,T7,T8>(
Action<T>eventExpression,
Funcfunc
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>
funcType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,TResult>)>)>
![Page 904: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/904.jpg)
TypeParametersT1T2T3T4T5T6T7T8
![Page 905: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/905.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 906: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/906.jpg)
C#
MoqIRaise<(Of<(<'T>)>)>..::..RaisesMethod(Action<(Of<(<'T>)>)>,array<Object>[]()[][])IRaise<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesthecustomeventthatwillberaisedwhenthesetupismatched.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 907: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/907.jpg)
SyntaxC#
IVerifiesRaises(
Action<T>eventExpression,
paramsObject[]args
)
Parameters
eventExpressionType:System..::..Action<(Of<(<'T>)>)>Anexpressionthatrepresentsaneventattachordetachaction.
argsType:array<System..::..Object>[]()[][]Theargumentstopasstothecustomdelegate(nonEventHandler-compatible).
![Page 908: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/908.jpg)
SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace
![Page 909: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/909.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>InterfaceMembersSeeAlsoSendFeedbackDefinestheReturnsverb.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 910: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/910.jpg)
SyntaxC#
publicinterfaceIReturns<TMock,TResult>:IHideObjectMembers
whereTMock:class
![Page 911: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/911.jpg)
TypeParametersTMock
Mockedtype.TResult
Typeofthereturnvaluefromtheexpression.
![Page 912: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/912.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>MembersMoq.LanguageNamespace
![Page 913: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/913.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIReturns<(Of<(<'TMock,TResult>)>)>MembersIReturns<(Of<(<'TMock,TResult>)>)>InterfaceMethodsSeeAlsoSendFeedback
![Page 914: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/914.jpg)
Methods Name Description
Returns(Func<(Of<(<'TResult>)>)>)
Returns(TResult) Specifiesthevaluetoreturn.
Returns<(Of<<'(T>)>>)(Func<(Of<(<'T,TResult>)>)>)
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,
Specifiesafunctionthatwillcalculatethevalueto
![Page 915: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/915.jpg)
T15>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,TResult>)>>))
returnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2>)>>)(Func<(Of<(<'T1,T2,TResult>)>)>)Returns<(Of<<'(T1,T2,T3>)>>)(Func<(Of<(<'T1,T2,T3,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4>)>>)(Func<(Of<(<'T1,T2,T3,T4,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,TResult>)>)>)
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
![Page 916: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/916.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceMoq.LanguageNamespace
![Page 917: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/917.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIReturns<(Of<(<'TMock,TResult>)>)>MethodsIReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
![Page 918: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/918.jpg)
Methods Name Description
Returns(Func<(Of<(<'TResult>)>)>)
Returns(TResult) Specifiesthevaluetoreturn.
Returns<(Of<<'(T>)>>)(Func<(Of<(<'T,TResult>)>)>)
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,
Specifiesafunctionthatwillcalculatethevalueto
![Page 919: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/919.jpg)
T15>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,TResult>)>>))
returnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2>)>>)(Func<(Of<(<'T1,T2,TResult>)>)>)Returns<(Of<<'(T1,T2,T3>)>>)(Func<(Of<(<'T1,T2,T3,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4>)>>)(Func<(Of<(<'T1,T2,T3,T4,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,TResult>)>)>)
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
![Page 920: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/920.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceMoq.LanguageNamespace
![Page 921: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/921.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..ReturnsMethodIReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
![Page 922: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/922.jpg)
OverloadList Name Description
Returns(Func<(Of<(<'TResult>)>)>)
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6, Specifiesafunctionthat
![Page 923: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/923.jpg)
T7,T8,T9,T10,T11,T12,T13,T14,T15>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,TResult>)>>))
willcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>>)(Func<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,TResult>)>>))
Specifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Returns<(Of<<'(T>)>>)(Func<(Of<(<'T,TResult>)>)>)Returns<(Of<<'(T1,T2>)>>)(Func<(Of<(<'T1,T2,TResult>)>)>)Returns<(Of<<'(T1,T2,T3>)>>)(Func<(Of<(<'T1,T2,T3,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4>)>>)(Func<(Of<(<'T1,T2,T3,T4,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,TResult>)>)>)Returns<(Of<<'(T1,T2,T3,T4,T5,T6,T7,T8>)>>)(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,TResult>)>)>)
Returns(TResult) Specifiesthevaluetoreturn.
![Page 924: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/924.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceIReturns<(Of<(<'TMock,TResult>)>)>MembersMoq.LanguageNamespace
![Page 925: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/925.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..ReturnsMethod(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns(System.Func`1)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 926: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/926.jpg)
SyntaxC#
IReturnsResult<TMock>Returns(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'TResult>)>)>
![Page 927: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/927.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 928: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/928.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9>)>)>Method(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,TResult>)>)>)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 929: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/929.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8,T9>(
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,TResult>valueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,TResult>)>)>Thefunctionthatwillcalculatethereturnvalue.
![Page 930: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/930.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.
![Page 931: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/931.jpg)
Copy
ExamplesThereturnvalueiscalculatedfromthevalueoftheactualmethodinvocationarguments.Noticehowtheargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpression:
C#
mock.Setup(x=>x.Execute(
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>()))
.Returns((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 932: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/932.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 933: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/933.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>)>)>Method(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,TResult>)>)>)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 934: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/934.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,TResult>valueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,TResult>)>)>Thefunctionthatwillcalculatethereturnvalue.
![Page 935: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/935.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.
![Page 936: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/936.jpg)
Copy
ExamplesThereturnvalueiscalculatedfromthevalueoftheactualmethodinvocationarguments.Noticehowtheargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpression:
C#
mock.Setup(x=>x.Execute(
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>()))
.Returns((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 937: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/937.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 938: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/938.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>)>)>Method(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,TResult>)>)>)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 939: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/939.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,TResult>
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,TResult>)>)>Thefunctionthatwillcalculatethereturnvalue.
![Page 940: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/940.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.
![Page 941: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/941.jpg)
Copy
ExamplesThereturnvalueiscalculatedfromthevalueoftheactualmethodinvocationarguments.Noticehowtheargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpression:
C#
mock.Setup(x=>x.Execute(
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>()))
.Returns((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 942: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/942.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 943: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/943.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>)>)>Method(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,TResult>)>)>)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 944: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/944.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,TResult>
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,TResult>)>)>Thefunctionthatwillcalculatethereturnvalue.
![Page 945: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/945.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.
![Page 946: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/946.jpg)
Copy
ExamplesThereturnvalueiscalculatedfromthevalueoftheactualmethodinvocationarguments.Noticehowtheargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpression:
C#
mock.Setup(x=>x.Execute(
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>()))
.Returns((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 947: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/947.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 948: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/948.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>)>)>Method(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,TResult>)>)>)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 949: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/949.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,TResult>
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,TResult>)>)>Thefunctionthatwillcalculatethereturnvalue.
![Page 950: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/950.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.
![Page 951: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/951.jpg)
Copy
ExamplesThereturnvalueiscalculatedfromthevalueoftheactualmethodinvocationarguments.Noticehowtheargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpression:
C#
mock.Setup(x=>x.Execute(
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>()))
.Returns((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 952: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/952.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 953: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/953.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>)>)>Method(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,TResult>)>)>)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 954: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/954.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,TResult>
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,TResult>)>)>Thefunctionthatwillcalculatethereturnvalue.
![Page 955: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/955.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.
![Page 956: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/956.jpg)
Copy
ExamplesThereturnvalueiscalculatedfromthevalueoftheactualmethodinvocationarguments.Noticehowtheargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpression:
C#
mock.Setup(x=>x.Execute(
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>()))
.Returns((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 957: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/957.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 958: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/958.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>)>)>Method(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,TResult>)>)>)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 959: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/959.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,TResult>
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,TResult>)>)>Thefunctionthatwillcalculatethereturnvalue.
![Page 960: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/960.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.T15
Thetypeofthefifteenthargumentoftheinvokedmethod.
![Page 961: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/961.jpg)
Copy
ExamplesThereturnvalueiscalculatedfromthevalueoftheactualmethodinvocationarguments.Noticehowtheargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpression:
C#
mock.Setup(x=>x.Execute(
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>()))
.Returns((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 962: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/962.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 963: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/963.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>)>)>Method(Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,TResult>)>)>)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesafunctionthatwillcalculatethevaluetoreturnfromthemethod,retrievingtheargumentsfortheinvocation.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 964: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/964.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(
Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,TResult>
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,TResult>)>)>Thefunctionthatwillcalculatethereturnvalue.
![Page 965: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/965.jpg)
TypeParametersT1
Thetypeofthefirstargumentoftheinvokedmethod.T2
Thetypeofthesecondargumentoftheinvokedmethod.T3
Thetypeofthethirdargumentoftheinvokedmethod.T4
Thetypeofthefourthargumentoftheinvokedmethod.T5
Thetypeofthefifthargumentoftheinvokedmethod.T6
Thetypeofthesixthargumentoftheinvokedmethod.T7
Thetypeoftheseventhargumentoftheinvokedmethod.T8
Thetypeoftheeighthargumentoftheinvokedmethod.T9
Thetypeoftheninethargumentoftheinvokedmethod.T10
Thetypeofthetenthargumentoftheinvokedmethod.T11
Thetypeoftheeleventhargumentoftheinvokedmethod.T12
Thetypeofthetwelfthargumentoftheinvokedmethod.T13
Thetypeofthethirteenthargumentoftheinvokedmethod.T14
Thetypeofthefourteenthargumentoftheinvokedmethod.T15
Thetypeofthefifteenthargumentoftheinvokedmethod.T16
Thetypeofthesixteenthargumentoftheinvokedmethod.
![Page 966: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/966.jpg)
Copy
ExamplesThereturnvalueiscalculatedfromthevalueoftheactualmethodinvocationarguments.Noticehowtheargumentsareretrievedbysimplydeclaringthemaspartofthelambdaexpression:
C#
mock.Setup(x=>x.Execute(
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>()))
.Returns((stringarg1,stringarg2,stringarg3,stringarg4,string
![Page 967: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/967.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 968: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/968.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T>)>)>Method(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns``1(System.Func`2)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 969: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/969.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T>(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T,TResult>)>)>
![Page 970: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/970.jpg)
TypeParametersT
![Page 971: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/971.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 972: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/972.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2>)>)>Method(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns``2(System.Func`3)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 973: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/973.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2>(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,TResult>)>)>
![Page 974: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/974.jpg)
TypeParametersT1T2
![Page 975: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/975.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 976: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/976.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3>)>)>Method(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns``3(System.Func`4)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 977: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/977.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3>(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,TResult>)>)>
![Page 978: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/978.jpg)
TypeParametersT1T2T3
![Page 979: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/979.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 980: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/980.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4>)>)>Method(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns``4(System.Func`5)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 981: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/981.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4>(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,TResult>)>)>
![Page 982: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/982.jpg)
TypeParametersT1T2T3T4
![Page 983: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/983.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 984: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/984.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5>)>)>Method(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns``5(System.Func`6)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 985: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/985.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5>(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,TResult>)>)>
![Page 986: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/986.jpg)
TypeParametersT1T2T3T4T5
![Page 987: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/987.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 988: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/988.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6>)>)>Method(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns``6(System.Func`7)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 989: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/989.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6>(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,TResult>)>)>
![Page 990: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/990.jpg)
TypeParametersT1T2T3T4T5T6
![Page 991: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/991.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 992: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/992.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7>)>)>Method(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns``7(System.Func`8)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 993: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/993.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7>(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,TResult>)>)>
![Page 994: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/994.jpg)
TypeParametersT1T2T3T4T5T6T7
![Page 995: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/995.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 996: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/996.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..Returns<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8>)>)>Method(Func)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturns`2.Returns``8(System.Func`9)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 997: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/997.jpg)
SyntaxC#
IReturnsResult<TMock>Returns<T1,T2,T3,T4,T5,T6,T7,T8>(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'T1,T2,T3,T4,T5,T6,T7,T8,TResult>)>)>
![Page 998: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/998.jpg)
TypeParametersT1T2T3T4T5T6T7T8
![Page 999: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/999.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 1000: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1000.jpg)
C#
MoqIReturns<(Of<(<'TMock,TResult>)>)>..::..ReturnsMethod(TResult)IReturns<(Of<(<'TMock,TResult>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesthevaluetoreturn.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1001: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1001.jpg)
SyntaxC#
IReturnsResult<TMock>Returns(
TResultvalue
)
Parameters
valueType:TResultThevaluetoreturn,ornullNothingnullptranullreference(NothinginVisualBasic).
![Page 1002: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1002.jpg)
Copy
ExamplesReturnatruevaluefromthemethodcall:
C#
mock.Setup(x=>x.Execute("ping"))
.Returns(true);
![Page 1003: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1003.jpg)
SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 1004: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1004.jpg)
C#
MoqIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMembersSeeAlsoSendFeedbackDefinestheReturnsverbforpropertygetsetups.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1005: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1005.jpg)
SyntaxC#
publicinterfaceIReturnsGetter<TMock,TProperty>:IHideObjectMembers
whereTMock:class
![Page 1006: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1006.jpg)
TypeParametersTMock
Mockedtype.TProperty
Typeoftheproperty.
![Page 1007: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1007.jpg)
SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>MembersMoq.LanguageNamespace
![Page 1008: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1008.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIReturnsGetter<(Of<(<'TMock,TProperty>)>)>MembersIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMethodsSeeAlsoSendFeedback
![Page 1009: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1009.jpg)
Methods Name Description
Returns(Func<(Of<(<'TResult>)>)>)Returns(TProperty) Specifiesthevaluetoreturn.
![Page 1010: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1010.jpg)
SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace
![Page 1011: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1011.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIReturnsGetter<(Of<(<'TMock,TProperty>)>)>MethodsIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceSeeAlsoSendFeedback
![Page 1012: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1012.jpg)
Methods Name Description
Returns(Func<(Of<(<'TResult>)>)>)Returns(TProperty) Specifiesthevaluetoreturn.
![Page 1013: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1013.jpg)
SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace
![Page 1014: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1014.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIReturnsGetter<(Of<(<'TMock,TProperty>)>)>..::..ReturnsMethodIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceSeeAlsoSendFeedback
![Page 1015: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1015.jpg)
OverloadList Name Description
Returns(Func<(Of<(<'TResult>)>)>)Returns(TProperty) Specifiesthevaluetoreturn.
![Page 1016: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1016.jpg)
SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceIReturnsGetter<(Of<(<'TMock,TProperty>)>)>MembersMoq.LanguageNamespace
![Page 1017: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1017.jpg)
C#
MoqIReturnsGetter<(Of<(<'TMock,TProperty>)>)>..::..ReturnsMethod(Func)IReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.IReturnsGetter`2.Returns(System.Func`1)"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1018: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1018.jpg)
SyntaxC#
IReturnsResult<TMock>Returns(
FuncvalueFunction
)
Parameters
valueFunctionType:System..::..Func<(Of<(<'TResult>)>)>
![Page 1019: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1019.jpg)
SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 1020: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1020.jpg)
C#
MoqIReturnsGetter<(Of<(<'TMock,TProperty>)>)>..::..ReturnsMethod(TProperty)IReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceExampleSeeAlsoSendFeedbackSpecifiesthevaluetoreturn.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1021: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1021.jpg)
SyntaxC#
IReturnsResult<TMock>Returns(
TPropertyvalue
)
Parameters
valueType:TPropertyThevaluetoreturn,ornullNothingnullptranullreference(NothinginVisualBasic).
![Page 1022: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1022.jpg)
Copy
ExamplesReturnatruevaluefromthepropertygettercall:
C#
mock.SetupGet(x=>x.Suspended)
.Returns(true);
![Page 1023: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1023.jpg)
SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace
![Page 1024: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1024.jpg)
C#
MoqISetupConditionResult<(Of<(<'T>)>)>InterfaceMembersSeeAlsoSendFeedbackImplementsthefluentAPI.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1025: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1025.jpg)
SyntaxC#
publicinterfaceISetupConditionResult<T>
whereT:class
![Page 1026: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1026.jpg)
TypeParametersT
![Page 1027: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1027.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>MembersMoq.LanguageNamespace
![Page 1028: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1028.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqISetupConditionResult<(Of<(<'T>)>)>MembersISetupConditionResult<(Of<(<'T>)>)>InterfaceMethodsSeeAlsoSendFeedback
TheISetupConditionResult<(Of<(<'T>)>)>typeexposesthefollowingmembers.
![Page 1029: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1029.jpg)
Methods Name Description
Setup(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Theexpectationwillbeconsideredonlyintheformercondition.
Setup<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))SetupGet<(Of<<'(TProperty>)>>)SetupSet(Action<(Of<<'(T>)>>)) Setupstheset.SetupSet<(Of<<'(TProperty>)>>)(Action<(Of<<'(T>)>>)) Setupstheset.
![Page 1030: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1030.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace
![Page 1031: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1031.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqISetupConditionResult<(Of<(<'T>)>)>MethodsISetupConditionResult<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
TheISetupConditionResult<(Of<(<'T>)>)>typeexposesthefollowingmembers.
![Page 1032: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1032.jpg)
Methods Name Description
Setup(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Theexpectationwillbeconsideredonlyintheformercondition.
Setup<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))SetupGet<(Of<<'(TProperty>)>>)SetupSet(Action<(Of<<'(T>)>>)) Setupstheset.SetupSet<(Of<<'(TProperty>)>>)(Action<(Of<<'(T>)>>)) Setupstheset.
![Page 1033: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1033.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace
![Page 1034: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1034.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqISetupConditionResult<(Of<(<'T>)>)>..::..SetupMethodISetupConditionResult<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
![Page 1035: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1035.jpg)
OverloadList Name Description
Setup(Expression<(Of<<'(Action<(Of<<'(T>)>>)>)>>))
Theexpectationwillbeconsideredonlyintheformercondition.
Setup<(Of<<'(TResult>)>>)(Expression<(Of<<'(Func<(Of<(<'T,TResult>)>)>>)>>))
![Page 1036: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1036.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceISetupConditionResult<(Of<(<'T>)>)>MembersMoq.LanguageNamespace
![Page 1037: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1037.jpg)
C#
MoqISetupConditionResult<(Of<(<'T>)>)>..::..SetupMethod(Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>)ISetupConditionResult<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackTheexpectationwillbeconsideredonlyintheformercondition.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1038: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1038.jpg)
SyntaxC#
ISetup<T>Setup(
Expression<Action<T>>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Action<(Of<(<'T>)>)>>)>)>
ReturnValue
![Page 1039: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1039.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceSetupOverloadMoq.LanguageNamespace
![Page 1040: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1040.jpg)
C#
MoqISetupConditionResult<(Of<(<'T>)>)>..::..Setup<(Of<(<'TResult>)>)>Method(Expression<(Of<(<'Func>)>)>)ISetupConditionResult<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ISetupConditionResult`1.Setup``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1041: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1041.jpg)
SyntaxC#
ISetup<T,TResult>Setup<TResult>(
Expression<Func>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 1042: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1042.jpg)
TypeParametersTResult
![Page 1043: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1043.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceSetupOverloadMoq.LanguageNamespace
![Page 1044: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1044.jpg)
C#
MoqISetupConditionResult<(Of<(<'T>)>)>..::..SetupGet<(Of<(<'TProperty>)>)>MethodISetupConditionResult<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Language.ISetupConditionResult`1.SetupGet``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1045: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1045.jpg)
SyntaxC#
ISetupGetter<T,TProperty>SetupGet<TProperty>(
Expression<Func>expression
)
Parameters
expressionType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 1046: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1046.jpg)
TypeParametersTProperty
![Page 1047: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1047.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace
![Page 1048: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1048.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqISetupConditionResult<(Of<(<'T>)>)>..::..SetupSetMethodISetupConditionResult<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedback
![Page 1049: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1049.jpg)
OverloadList Name Description
SetupSet(Action<(Of<<'(T>)>>)) Setupstheset.
SetupSet<(Of<<'(TProperty>)>>)(Action<(Of<<'(T>)>>))
Setupstheset.
![Page 1050: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1050.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceISetupConditionResult<(Of<(<'T>)>)>MembersMoq.LanguageNamespace
![Page 1051: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1051.jpg)
C#
MoqISetupConditionResult<(Of<(<'T>)>)>..::..SetupSetMethod(Action<(Of<(<'T>)>)>)ISetupConditionResult<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSetupstheset.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1052: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1052.jpg)
SyntaxC#
ISetup<T>SetupSet(
Action<T>setterExpression
)
Parameters
setterExpressionType:System..::..Action<(Of<(<'T>)>)>Thesetterexpression.
ReturnValue
![Page 1053: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1053.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceSetupSetOverloadMoq.LanguageNamespace
![Page 1054: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1054.jpg)
C#
MoqISetupConditionResult<(Of<(<'T>)>)>..::..SetupSet<(Of<(<'TProperty>)>)>Method(Action<(Of<(<'T>)>)>)ISetupConditionResult<(Of<(<'T>)>)>InterfaceSeeAlsoSendFeedbackSetupstheset.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1055: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1055.jpg)
SyntaxC#
ISetupSetter<T,TProperty>SetupSet<TProperty>(
Action<T>setterExpression
)
Parameters
setterExpressionType:System..::..Action<(Of<(<'T>)>)>Thesetterexpression.
![Page 1056: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1056.jpg)
TypeParametersTProperty
Thetypeoftheproperty.
ReturnValue
![Page 1057: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1057.jpg)
SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceSetupSetOverloadMoq.LanguageNamespace
![Page 1058: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1058.jpg)
C#
MoqISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceMembersSeeAlsoSendFeedbackLanguageforReturnSequence
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1059: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1059.jpg)
SyntaxC#
publicinterfaceISetupSequentialResult<TResult>
![Page 1060: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1060.jpg)
TypeParametersTResult
![Page 1061: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1061.jpg)
SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>MembersMoq.LanguageNamespace
![Page 1062: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1062.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqISetupSequentialResult<(Of<(<'TResult>)>)>MembersISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceMethodsSeeAlsoSendFeedback
TheISetupSequentialResult<(Of<(<'TResult>)>)>typeexposesthefollowingmembers.
![Page 1063: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1063.jpg)
Methods Name Description
Returns ReturnsvalueThrows(Exception) ThrowsanexceptionThrows<(Of<<'(TException>)>>)()()()() Throwsanexception
![Page 1064: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1064.jpg)
SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceMoq.LanguageNamespace
![Page 1065: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1065.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqISetupSequentialResult<(Of<(<'TResult>)>)>MethodsISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceSeeAlsoSendFeedback
TheISetupSequentialResult<(Of<(<'TResult>)>)>typeexposesthefollowingmembers.
![Page 1066: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1066.jpg)
Methods Name Description
Returns ReturnsvalueThrows(Exception) ThrowsanexceptionThrows<(Of<<'(TException>)>>)()()()() Throwsanexception
![Page 1067: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1067.jpg)
SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceMoq.LanguageNamespace
![Page 1068: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1068.jpg)
C#
MoqISetupSequentialResult<(Of<(<'TResult>)>)>..::..ReturnsMethodISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceSeeAlsoSendFeedbackReturnsvalue
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1069: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1069.jpg)
SyntaxC#
ISetupSequentialResult<TResult>Returns(
TResultvalue
)
Parameters
valueType:TResult
![Page 1070: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1070.jpg)
SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceMoq.LanguageNamespace
![Page 1071: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1071.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqISetupSequentialResult<(Of<(<'TResult>)>)>..::..ThrowsMethodISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceSeeAlsoSendFeedback
![Page 1072: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1072.jpg)
OverloadList Name Description
Throws<(Of<<'(TException>)>>)()()()() ThrowsanexceptionThrows(Exception) Throwsanexception
![Page 1073: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1073.jpg)
SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceISetupSequentialResult<(Of<(<'TResult>)>)>MembersMoq.LanguageNamespace
![Page 1074: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1074.jpg)
C#
MoqISetupSequentialResult<(Of<(<'TResult>)>)>..::..Throws<(Of<(<'TException>)>)>MethodISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceSeeAlsoSendFeedbackThrowsanexception
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1075: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1075.jpg)
SyntaxC#
voidThrows<TException>()
whereTException:new(),Exception
![Page 1076: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1076.jpg)
TypeParametersTException
![Page 1077: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1077.jpg)
SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceThrowsOverloadMoq.LanguageNamespace
![Page 1078: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1078.jpg)
C#
MoqISetupSequentialResult<(Of<(<'TResult>)>)>..::..ThrowsMethod(Exception)ISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceSeeAlsoSendFeedbackThrowsanexception
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1079: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1079.jpg)
SyntaxC#
voidThrows(
Exceptionexception
)
Parameters
exceptionType:System..::..Exception
![Page 1080: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1080.jpg)
SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceThrowsOverloadMoq.LanguageNamespace
![Page 1081: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1081.jpg)
C#
MoqIThrowsInterfaceMembersSeeAlsoSendFeedbackDefinestheThrowsverb.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1082: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1082.jpg)
SyntaxC#
publicinterfaceIThrows:IHideObjectMembers
![Page 1083: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1083.jpg)
SeeAlsoIThrowsMembersMoq.LanguageNamespace
![Page 1084: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1084.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIThrowsMembersIThrowsInterfaceMethodsSeeAlsoSendFeedback
![Page 1085: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1085.jpg)
Methods Name Description
Throws(Exception) Specifiestheexceptiontothrowwhenthemethodisinvoked.
Throws<(Of<<'(TException>)>>)()()()()
Specifiesthetypeofexceptiontothrowwhenthemethodisinvoked.
![Page 1086: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1086.jpg)
SeeAlsoIThrowsInterfaceMoq.LanguageNamespace
![Page 1087: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1087.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIThrowsMethodsIThrowsInterfaceSeeAlsoSendFeedback
![Page 1088: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1088.jpg)
Methods Name Description
Throws(Exception) Specifiestheexceptiontothrowwhenthemethodisinvoked.
Throws<(Of<<'(TException>)>>)()()()()
Specifiesthetypeofexceptiontothrowwhenthemethodisinvoked.
![Page 1089: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1089.jpg)
SeeAlsoIThrowsInterfaceMoq.LanguageNamespace
![Page 1090: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1090.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIThrows..::..ThrowsMethodIThrowsInterfaceSeeAlsoSendFeedback
![Page 1091: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1091.jpg)
OverloadList Name Description
Throws<(Of<<'(TException>)>>)()()()()
Specifiesthetypeofexceptiontothrowwhenthemethodisinvoked.
Throws(Exception) Specifiestheexceptiontothrowwhenthemethodisinvoked.
![Page 1092: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1092.jpg)
SeeAlsoIThrowsInterfaceIThrowsMembersMoq.LanguageNamespace
![Page 1093: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1093.jpg)
C#
MoqIThrows..::..Throws<(Of<(<'TException>)>)>MethodIThrowsInterfaceExampleSeeAlsoSendFeedbackSpecifiesthetypeofexceptiontothrowwhenthemethodisinvoked.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1094: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1094.jpg)
SyntaxC#
IThrowsResultThrows<TException>()
whereTException:new(),Exception
![Page 1095: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1095.jpg)
TypeParametersTException
Typeofexceptiontoinstantiateandthrowwhenthesetupismatched.
![Page 1096: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1096.jpg)
Copy
ExamplesThisexampleshowshowtothrowanexceptionwhenthemethodisinvokedwithanemptystringargument:
C#
mock.Setup(x=>x.Execute(""))
.Throws<ArgumentException>();
![Page 1097: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1097.jpg)
SeeAlsoIThrowsInterfaceThrowsOverloadMoq.LanguageNamespace
![Page 1098: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1098.jpg)
C#
MoqIThrows..::..ThrowsMethod(Exception)IThrowsInterfaceExampleSeeAlsoSendFeedbackSpecifiestheexceptiontothrowwhenthemethodisinvoked.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1099: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1099.jpg)
SyntaxC#
IThrowsResultThrows(
Exceptionexception
)
Parameters
exceptionType:System..::..ExceptionExceptioninstancetothrow.
![Page 1100: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1100.jpg)
Copy
ExamplesThisexampleshowshowtothrowanexceptionwhenthemethodisinvokedwithanemptystringargument:
C#
mock.Setup(x=>x.Execute(""))
.Throws(newArgumentException());
![Page 1101: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1101.jpg)
SeeAlsoIThrowsInterfaceThrowsOverloadMoq.LanguageNamespace
![Page 1102: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1102.jpg)
C#
MoqIVerifiesInterfaceMembersSeeAlsoSendFeedbackDefinestheVerifiableverb.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1103: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1103.jpg)
SyntaxC#
publicinterfaceIVerifies:IHideObjectMembers
![Page 1104: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1104.jpg)
SeeAlsoIVerifiesMembersMoq.LanguageNamespace
![Page 1105: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1105.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIVerifiesMembersIVerifiesInterfaceMethodsSeeAlsoSendFeedback
![Page 1106: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1106.jpg)
Methods Name Description
Verifiable()()()()Markstheexpectationasverifiable,meaningthatacalltoVerify()()()()willcheckifthisparticularexpectationwasmet.
Verifiable(String)
Markstheexpectationasverifiable,meaningthatacalltoVerify()()()()willcheckifthisparticularexpectationwasmet,andspecifiesamessageforfailures.
![Page 1107: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1107.jpg)
SeeAlsoIVerifiesInterfaceMoq.LanguageNamespace
![Page 1108: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1108.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIVerifiesMethodsIVerifiesInterfaceSeeAlsoSendFeedback
![Page 1109: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1109.jpg)
Methods Name Description
Verifiable()()()()Markstheexpectationasverifiable,meaningthatacalltoVerify()()()()willcheckifthisparticularexpectationwasmet.
Verifiable(String)
Markstheexpectationasverifiable,meaningthatacalltoVerify()()()()willcheckifthisparticularexpectationwasmet,andspecifiesamessageforfailures.
![Page 1110: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1110.jpg)
SeeAlsoIVerifiesInterfaceMoq.LanguageNamespace
![Page 1111: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1111.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIVerifies..::..VerifiableMethodIVerifiesInterfaceSeeAlsoSendFeedback
![Page 1112: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1112.jpg)
OverloadList Name Description
Verifiable()()()()Markstheexpectationasverifiable,meaningthatacalltoVerify()()()()willcheckifthisparticularexpectationwasmet.
Verifiable(String)
Markstheexpectationasverifiable,meaningthatacalltoVerify()()()()willcheckifthisparticularexpectationwasmet,andspecifiesamessageforfailures.
![Page 1113: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1113.jpg)
SeeAlsoIVerifiesInterfaceIVerifiesMembersMoq.LanguageNamespace
![Page 1114: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1114.jpg)
C#
MoqIVerifies..::..VerifiableMethodIVerifiesInterfaceExampleSeeAlsoSendFeedbackMarkstheexpectationasverifiable,meaningthatacalltoVerify()()()()willcheckifthisparticularexpectationwasmet.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1115: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1115.jpg)
SyntaxC#
voidVerifiable()
![Page 1116: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1116.jpg)
Copy
ExamplesThefollowingexamplemarkstheexpectationasverifiable:
C#
mock.Expect(x=>x.Execute("ping"))
.Returns(true)
.Verifiable();
![Page 1117: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1117.jpg)
SeeAlsoIVerifiesInterfaceVerifiableOverloadMoq.LanguageNamespace
![Page 1118: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1118.jpg)
C#
MoqIVerifies..::..VerifiableMethod(String)IVerifiesInterfaceExampleSeeAlsoSendFeedbackMarkstheexpectationasverifiable,meaningthatacalltoVerify()()()()willcheckifthisparticularexpectationwasmet,andspecifiesamessageforfailures.
Namespace:Moq.LanguageAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1119: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1119.jpg)
SyntaxC#
voidVerifiable(
stringfailMessage
)
Parameters
failMessageType:System..::..String
![Page 1120: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1120.jpg)
Copy
ExamplesThefollowingexamplemarkstheexpectationasverifiable:
C#
mock.Expect(x=>x.Execute("ping"))
.Returns(true)
.Verifiable("Pingshouldbeexecutedalways!");
![Page 1121: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1121.jpg)
SeeAlsoIVerifiesInterfaceVerifiableOverloadMoq.LanguageNamespace
![Page 1122: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1122.jpg)
C#
MoqMoq.ProtectedNamespaceSendFeedbackImportingthisnamespacewillenabletheProtected()methodonmocks,enablingexpectationsonprotectedmembersbyspecifyingthemembernameasastring.
![Page 1123: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1123.jpg)
Classes Class Description
ItExpr
Allowsthespecificationofamatchingconditionforanargumentinaprotectedmembersetup,ratherthanaspecificargumentvalue."ItExpr"referstotheargumentbeingmatched.
ProtectedExtension
EnablestheProtected()methodonMock<(Of<(<'T>)>)>,allowingsetupstobesetforprotectedmembersbyusingtheirnameasastring,ratherthanstrong-typingthemwhichisnotpossibleduetotheirvisibility.
![Page 1124: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1124.jpg)
Interfaces Interface Description
IProtectedMock<(Of<(<'TMock>)>)>
Allowssetupstobespecifiedforprotectedmembersbyusingtheirnameasastring,ratherthanstrong-typingthemwhichisnotpossibleduetotheirvisibility.
![Page 1125: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1125.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>InterfaceMembersSeeAlsoSendFeedbackAllowssetupstobespecifiedforprotectedmembersbyusingtheirnameasastring,ratherthanstrong-typingthemwhichisnotpossibleduetotheirvisibility.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1126: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1126.jpg)
SyntaxC#
publicinterfaceIProtectedMock<TMock>:IHideObjectMembers
whereTMock:class
![Page 1127: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1127.jpg)
TypeParametersTMock
![Page 1128: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1128.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>MembersMoq.ProtectedNamespace
![Page 1129: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1129.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIProtectedMock<(Of<(<'TMock>)>)>MembersIProtectedMock<(Of<(<'TMock>)>)>InterfaceMethodsSeeAlsoSendFeedback
TheIProtectedMock<(Of<(<'TMock>)>)>typeexposesthefollowingmembers.
![Page 1130: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1130.jpg)
Methods Name Description
Setup(String,array<Object>[]()[][])
SpecifiesasetupforavoidmethodinvocationwiththegivenvoidMethodName,optionallyspecifyingargumentsforthemethodcall.
Setup<(Of<<'(TResult>)>>)(String,array<Object>[]()[][])
SpecifiesasetupforaninvocationonapropertyoranonvoidmethodwiththegivenmethodOrPropertyName,optionallyspecifyingargumentsforthemethodcall.
SetupGet<(Of<<'(TProperty>)>>)
SpecifiesasetupforaninvocationonapropertygetterwiththegivenpropertyName.
SetupSet<(Of<<'(TProperty>)>>)
SpecifiesasetupforaninvocationonapropertysetterwiththegivenpropertyName.
Verify(String,Times,array<Object>[]()[][])
SpecifiesaverifyforavoidmethodwiththegivenmethodName,optionallyspecifyingargumentsforthemethodcall.UseinconjuntionwiththedefaultLoose.
Verify<(Of<<'(TResult>)>>)(String,Times,array<Object>[]()[][])
SpecifiesaverifyforaninvocationonapropertyoranonvoidmethodwiththegivenmethodName,optionallyspecifyingargumentsforthemethodcall.
VerifyGet<(Of<<'(TProperty>)>>)
SpecifiesaverifyforaninvocationonapropertygetterwiththegivenpropertyName.Theinvocationwasnotcallthetimesspecifiedbytimes.
VerifySet<(Of<<'(TProperty>)>>)
SpecifiesasetupforaninvocationonapropertysetterwiththegivenpropertyName.
![Page 1131: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1131.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace
![Page 1132: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1132.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIProtectedMock<(Of<(<'TMock>)>)>MethodsIProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedback
TheIProtectedMock<(Of<(<'TMock>)>)>typeexposesthefollowingmembers.
![Page 1133: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1133.jpg)
Methods Name Description
Setup(String,array<Object>[]()[][])
SpecifiesasetupforavoidmethodinvocationwiththegivenvoidMethodName,optionallyspecifyingargumentsforthemethodcall.
Setup<(Of<<'(TResult>)>>)(String,array<Object>[]()[][])
SpecifiesasetupforaninvocationonapropertyoranonvoidmethodwiththegivenmethodOrPropertyName,optionallyspecifyingargumentsforthemethodcall.
SetupGet<(Of<<'(TProperty>)>>)
SpecifiesasetupforaninvocationonapropertygetterwiththegivenpropertyName.
SetupSet<(Of<<'(TProperty>)>>)
SpecifiesasetupforaninvocationonapropertysetterwiththegivenpropertyName.
Verify(String,Times,array<Object>[]()[][])
SpecifiesaverifyforavoidmethodwiththegivenmethodName,optionallyspecifyingargumentsforthemethodcall.UseinconjuntionwiththedefaultLoose.
Verify<(Of<<'(TResult>)>>)(String,Times,array<Object>[]()[][])
SpecifiesaverifyforaninvocationonapropertyoranonvoidmethodwiththegivenmethodName,optionallyspecifyingargumentsforthemethodcall.
VerifyGet<(Of<<'(TProperty>)>>)
SpecifiesaverifyforaninvocationonapropertygetterwiththegivenpropertyName.Theinvocationwasnotcallthetimesspecifiedbytimes.
VerifySet<(Of<<'(TProperty>)>>)
SpecifiesasetupforaninvocationonapropertysetterwiththegivenpropertyName.
![Page 1134: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1134.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace
![Page 1135: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1135.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..SetupMethodIProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedback
![Page 1136: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1136.jpg)
OverloadList Name Description
Setup<(Of<<'(TResult>)>>)(String,array<Object>[]()[][])
SpecifiesasetupforaninvocationonapropertyoranonvoidmethodwiththegivenmethodOrPropertyName,optionallyspecifyingargumentsforthemethodcall.
Setup(String,array<Object>[]()[][])
SpecifiesasetupforavoidmethodinvocationwiththegivenvoidMethodName,optionallyspecifyingargumentsforthemethodcall.
![Page 1137: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1137.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceIProtectedMock<(Of<(<'TMock>)>)>MembersMoq.ProtectedNamespace
![Page 1138: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1138.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..Setup<(Of<(<'TResult>)>)>Method(String,array<Object>[]()[][])IProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesasetupforaninvocationonapropertyoranonvoidmethodwiththegivenmethodOrPropertyName,optionallyspecifyingargumentsforthemethodcall.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1139: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1139.jpg)
SyntaxC#
ISetup<TMock,TResult>Setup<TResult>(
stringmethodOrPropertyName,
paramsObject[]args
)
Parameters
methodOrPropertyNameType:System..::..StringThenameofthemethodorpropertytobeinvoked.
argsType:array<System..::..Object>[]()[][]Theoptionalargumentsfortheinvocation.Ifargumentmatchersareused,remembertouseItExprratherthanIt.
![Page 1140: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1140.jpg)
TypeParametersTResult
Thereturntypeofthemethodorproperty.
![Page 1141: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1141.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceSetupOverloadMoq.ProtectedNamespace
![Page 1142: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1142.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..SetupMethod(String,array<Object>[]()[][])IProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesasetupforavoidmethodinvocationwiththegivenvoidMethodName,optionallyspecifyingargumentsforthemethodcall.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1143: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1143.jpg)
SyntaxC#
ISetup<TMock>Setup(
stringvoidMethodName,
paramsObject[]args
)
Parameters
voidMethodNameType:System..::..StringThenameofthevoidmethodtobeinvoked.
argsType:array<System..::..Object>[]()[][]Theoptionalargumentsfortheinvocation.Ifargumentmatchersareused,remembertouseItExprratherthanIt.
![Page 1144: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1144.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceSetupOverloadMoq.ProtectedNamespace
![Page 1145: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1145.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..SetupGet<(Of<(<'TProperty>)>)>MethodIProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesasetupforaninvocationonapropertygetterwiththegivenpropertyName.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1146: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1146.jpg)
SyntaxC#
ISetupGetter<TMock,TProperty>SetupGet<TProperty>(
stringpropertyName
)
Parameters
propertyNameType:System..::..StringThenameoftheproperty.
![Page 1147: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1147.jpg)
TypeParametersTProperty
Thetypeoftheproperty.
![Page 1148: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1148.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace
![Page 1149: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1149.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..SetupSet<(Of<(<'TProperty>)>)>MethodIProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesasetupforaninvocationonapropertysetterwiththegivenpropertyName.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1150: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1150.jpg)
SyntaxC#
ISetupSetter<TMock,TProperty>SetupSet<TProperty>(
stringpropertyName,
Objectvalue
)
Parameters
propertyNameType:System..::..StringThenameoftheproperty.
valueType:System..::..ObjectThepropertyvalue.Ifargumentmatchersareused,remembertouseItExprratherthanIt.
![Page 1151: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1151.jpg)
TypeParametersTProperty
Thetypeoftheproperty.
![Page 1152: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1152.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace
![Page 1153: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1153.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..VerifyMethodIProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedback
![Page 1154: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1154.jpg)
OverloadList Name Description
Verify<(Of<<'(TResult>)>>)(String,Times,array<Object>[]()[][])
SpecifiesaverifyforaninvocationonapropertyoranonvoidmethodwiththegivenmethodName,optionallyspecifyingargumentsforthemethodcall.
Verify(String,Times,array<Object>[]()[][])
SpecifiesaverifyforavoidmethodwiththegivenmethodName,optionallyspecifyingargumentsforthemethodcall.UseinconjuntionwiththedefaultLoose.
![Page 1155: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1155.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceIProtectedMock<(Of<(<'TMock>)>)>MembersMoq.ProtectedNamespace
![Page 1156: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1156.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..Verify<(Of<(<'TResult>)>)>Method(String,Times,array<Object>[]()[][])IProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesaverifyforaninvocationonapropertyoranonvoidmethodwiththegivenmethodName,optionallyspecifyingargumentsforthemethodcall.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1157: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1157.jpg)
SyntaxC#
voidVerify<TResult>(
stringmethodName,
Timestimes,
paramsObject[]args
)
Parameters
methodNameType:System..::..StringThenameofthemethodorpropertytobeinvoked.
timesType:Moq..::..TimesThenumberoftimesamethodisallowedtobecalled.
argsType:array<System..::..Object>[]()[][]Theoptionalargumentsfortheinvocation.Ifargumentmatchersareused,remembertouseItExprratherthanIt.
![Page 1158: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1158.jpg)
TypeParametersTResult
Thetypeofreturnvaluefromtheexpression.
![Page 1159: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1159.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotcallthetimesspecifiedbytimes.
![Page 1160: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1160.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceVerifyOverloadMoq.ProtectedNamespace
![Page 1161: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1161.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..VerifyMethod(String,Times,array<Object>[]()[][])IProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesaverifyforavoidmethodwiththegivenmethodName,optionallyspecifyingargumentsforthemethodcall.UseinconjuntionwiththedefaultLoose.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1162: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1162.jpg)
SyntaxC#
voidVerify(
stringmethodName,
Timestimes,
paramsObject[]args
)
Parameters
methodNameType:System..::..StringThenameofthevoidmethodtobeverified.
timesType:Moq..::..TimesThenumberoftimesamethodisallowedtobecalled.
argsType:array<System..::..Object>[]()[][]Theoptionalargumentsfortheinvocation.Ifargumentmatchersareused,remembertouseItExprratherthanIt.
![Page 1163: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1163.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotcallthetimesspecifiedbytimes.
![Page 1164: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1164.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceVerifyOverloadMoq.ProtectedNamespace
![Page 1165: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1165.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..VerifyGet<(Of<(<'TProperty>)>)>MethodIProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesaverifyforaninvocationonapropertygetterwiththegivenpropertyName.Theinvocationwasnotcallthetimesspecifiedbytimes.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1166: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1166.jpg)
SyntaxC#
voidVerifyGet<TProperty>(
stringpropertyName,
Timestimes
)
Parameters
propertyNameType:System..::..StringThenameoftheproperty.
timesType:Moq..::..TimesThenumberoftimesamethodisallowedtobecalled.
![Page 1167: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1167.jpg)
TypeParametersTProperty
Thetypeoftheproperty.
![Page 1168: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1168.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace
![Page 1169: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1169.jpg)
C#
MoqIProtectedMock<(Of<(<'TMock>)>)>..::..VerifySet<(Of<(<'TProperty>)>)>MethodIProtectedMock<(Of<(<'TMock>)>)>InterfaceSeeAlsoSendFeedbackSpecifiesasetupforaninvocationonapropertysetterwiththegivenpropertyName.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1170: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1170.jpg)
SyntaxC#
voidVerifySet<TProperty>(
stringpropertyName,
Timestimes,
Objectvalue
)
Parameters
propertyNameType:System..::..StringThenameoftheproperty.
timesType:Moq..::..TimesThenumberoftimesamethodisallowedtobecalled.
valueType:System..::..ObjectThepropertyvalue.
![Page 1171: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1171.jpg)
TypeParametersTProperty
Thetypeoftheproperty.Ifargumentmatchersareused,remembertouseItExprratherthanIt.
![Page 1172: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1172.jpg)
ExceptionsException Condition
Moq..::..MockException Theinvocationwasnotcallthetimesspecifiedbytimes.
![Page 1173: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1173.jpg)
SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace
![Page 1174: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1174.jpg)
C#
MoqItExprClassMembersSeeAlsoSendFeedbackAllowsthespecificationofamatchingconditionforanargumentinaprotectedmembersetup,ratherthanaspecificargumentvalue."ItExpr"referstotheargumentbeingmatched.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1175: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1175.jpg)
SyntaxC#
publicstaticclassItExpr
![Page 1176: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1176.jpg)
RemarksUsethisvariantofargumentmatchinginsteadofItforprotectedsetups.
Thisclassallowsthesetuptomatchamethodinvocationwithanarbitraryvalue,withavalueinaspecifiedrange,orevenonethatmatchesagivenpredicate,ornull.
![Page 1177: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1177.jpg)
InheritanceHierarchySystem..::..ObjectMoq.Protected..::..ItExpr
![Page 1178: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1178.jpg)
SeeAlsoItExprMembersMoq.ProtectedNamespace
![Page 1179: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1179.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqItExprMembersItExprClassMethodsSeeAlsoSendFeedback
TheItExprtypeexposesthefollowingmembers.
![Page 1180: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1180.jpg)
Methods Name Description
Is<(Of<<'(TValue>)>>)IsAny<(Of<<'(TValue>)>>) MatchesanyvalueofthegivenTValuetype.
IsInRange<(Of<<'(TValue>)>>) Matchesanyvaluethatisintherangespecified.
IsNull<(Of<<'(TValue>)>>) MatchesanullvalueofthegivenTValuetype.
IsRegex(String) Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
IsRegex(String,RegexOptions)
Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
![Page 1181: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1181.jpg)
SeeAlsoItExprClassMoq.ProtectedNamespace
![Page 1182: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1182.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqItExprMethodsItExprClassSeeAlsoSendFeedback
TheItExprtypeexposesthefollowingmembers.
![Page 1183: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1183.jpg)
Methods Name Description
Is<(Of<<'(TValue>)>>)IsAny<(Of<<'(TValue>)>>) MatchesanyvalueofthegivenTValuetype.
IsInRange<(Of<<'(TValue>)>>) Matchesanyvaluethatisintherangespecified.
IsNull<(Of<<'(TValue>)>>) MatchesanullvalueofthegivenTValuetype.
IsRegex(String) Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
IsRegex(String,RegexOptions)
Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
![Page 1184: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1184.jpg)
SeeAlsoItExprClassMoq.ProtectedNamespace
![Page 1185: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1185.jpg)
C#
MoqItExpr..::..Is<(Of<(<'TValue>)>)>MethodItExprClassSeeAlsoSendFeedback
[Missing<summary>documentationfor"M:Moq.Protected.ItExpr.Is``1(System.Linq.Expressions.Expression{System.Func`2})"]
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1186: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1186.jpg)
SyntaxC#
publicstaticExpressionIs<TValue>(
Expression<Func>match
)
Parameters
matchType:System.Linq.Expressions..::..Expression<(Of<(<'Func<(Of<(<'T,TResult>)>)>>)>)>
![Page 1187: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1187.jpg)
TypeParametersTValue
![Page 1188: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1188.jpg)
SeeAlsoItExprClassMoq.ProtectedNamespace
![Page 1189: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1189.jpg)
C#
MoqItExpr..::..IsAny<(Of<(<'TValue>)>)>MethodItExprClassExampleSeeAlsoSendFeedbackMatchesanyvalueofthegivenTValuetype.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1191: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1191.jpg)
TypeParametersTValue
Typeofthevalue.
![Page 1192: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1192.jpg)
RemarksTypicallyusedwhentheactualargumentvalueforamethodcallisnotrelevant.
![Page 1193: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1193.jpg)
Copy
ExamplesC#
//ThrowsanexceptionforacalltoRemovewithanystringvalue.
mock.Protected()
.Setup("Remove",ItExpr.IsAny<string>())
.Throws(newInvalidOperationException());
![Page 1194: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1194.jpg)
SeeAlsoItExprClassMoq.ProtectedNamespace
![Page 1195: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1195.jpg)
C#
MoqItExpr..::..IsInRange<(Of<(<'TValue>)>)>MethodItExprClassExampleSeeAlsoSendFeedbackMatchesanyvaluethatisintherangespecified.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1196: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1196.jpg)
SyntaxC#
publicstaticExpressionIsInRange<TValue>(
TValuefrom,
TValueto,
RangerangeKind
)
whereTValue:IComparable
Parameters
fromType:TValueThelowerboundoftherange.
toType:TValueTheupperboundoftherange.
rangeKindType:Moq..::..RangeThekindofrange.SeeRange.
![Page 1197: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1197.jpg)
TypeParametersTValue
Typeoftheargumenttocheck.
![Page 1198: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1198.jpg)
Copy
ExamplesThefollowingexampleshowshowtoexpectamethodcallwithanintegerargumentwithinthe0..100range.
C#
mock.Protected()
.Setup("HasInventory",
ItExpr.IsAny<string>(),
ItExpr.IsInRange(0,100,Range.Inclusive))
.Returns(false);
![Page 1199: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1199.jpg)
SeeAlsoItExprClassMoq.ProtectedNamespace
![Page 1200: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1200.jpg)
C#
MoqItExpr..::..IsNull<(Of<(<'TValue>)>)>MethodItExprClassExampleSeeAlsoSendFeedbackMatchesanullvalueofthegivenTValuetype.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1202: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1202.jpg)
TypeParametersTValue
Typeofthevalue.
![Page 1203: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1203.jpg)
RemarksRequiredforprotectedmocksasthenullvaluecannotbeuseddirectlyasitpreventspropermethodoverloadselection.
![Page 1204: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1204.jpg)
Copy
ExamplesC#
//ThrowsanexceptionforacalltoRemovewithanullstringvalue.
mock.Protected()
.Setup("Remove",ItExpr.IsNull<string>())
.Throws(newInvalidOperationException());
![Page 1205: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1205.jpg)
SeeAlsoItExprClassMoq.ProtectedNamespace
![Page 1206: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1206.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqItExpr..::..IsRegexMethodItExprClassSeeAlsoSendFeedback
![Page 1207: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1207.jpg)
OverloadList Name Description
IsRegex(String) Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
IsRegex(String,RegexOptions)
Matchesastringargumentifitmatchesthegivenregularexpressionpattern.
![Page 1208: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1208.jpg)
SeeAlsoItExprClassItExprMembersMoq.ProtectedNamespace
![Page 1209: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1209.jpg)
C#
MoqItExpr..::..IsRegexMethod(String)ItExprClassExampleSeeAlsoSendFeedbackMatchesastringargumentifitmatchesthegivenregularexpressionpattern.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1210: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1210.jpg)
SyntaxC#
publicstaticExpressionIsRegex(
stringregex
)
Parameters
regexType:System..::..StringThepatterntousetomatchthestringargumentvalue.
![Page 1211: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1211.jpg)
Copy
ExamplesThefollowingexampleshowshowtoexpectacalltoamethodwherethestringargumentmatchesthegivenregularexpression:
C#
mock.Protected()
.Setup("Check",ItExpr.IsRegex("[a-z]+"))
.Returns(1);
![Page 1212: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1212.jpg)
SeeAlsoItExprClassIsRegexOverloadMoq.ProtectedNamespace
![Page 1213: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1213.jpg)
C#
MoqItExpr..::..IsRegexMethod(String,RegexOptions)ItExprClassExampleSeeAlsoSendFeedbackMatchesastringargumentifitmatchesthegivenregularexpressionpattern.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1214: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1214.jpg)
SyntaxC#
publicstaticExpressionIsRegex(
stringregex,
RegexOptionsoptions
)
Parameters
regexType:System..::..StringThepatterntousetomatchthestringargumentvalue.
optionsType:System.Text.RegularExpressions..::..RegexOptionsTheoptionsusedtointerpretthepattern.
![Page 1215: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1215.jpg)
Copy
ExamplesThefollowingexampleshowshowtoexpectacalltoamethodwherethestringargumentmatchesthegivenregularexpression,inacaseinsensitiveway:
C#
mock.Protected()
.Setup("Check",ItExpr.IsRegex("[a-z]+",RegexOptions.IgnoreCase))
.Returns(1);
![Page 1216: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1216.jpg)
SeeAlsoItExprClassIsRegexOverloadMoq.ProtectedNamespace
![Page 1217: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1217.jpg)
C#
MoqProtectedExtensionClassMembersSeeAlsoSendFeedbackEnablestheProtected()methodonMock<(Of<(<'T>)>)>,allowingsetupstobesetforprotectedmembersbyusingtheirnameasastring,ratherthanstrong-typingthemwhichisnotpossibleduetotheirvisibility.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1218: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1218.jpg)
SyntaxC#
publicstaticclassProtectedExtension
![Page 1219: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1219.jpg)
InheritanceHierarchySystem..::..ObjectMoq.Protected..::..ProtectedExtension
![Page 1220: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1220.jpg)
SeeAlsoProtectedExtensionMembersMoq.ProtectedNamespace
![Page 1221: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1221.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqProtectedExtensionMembersProtectedExtensionClassMethodsSeeAlsoSendFeedback
TheProtectedExtensiontypeexposesthefollowingmembers.
![Page 1222: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1222.jpg)
Methods Name Description
Protected<(Of<<'(T>)>>) Enableprotectedsetupsforthemock.
![Page 1223: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1223.jpg)
SeeAlsoProtectedExtensionClassMoq.ProtectedNamespace
![Page 1224: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1224.jpg)
C#IncludeProtectedMembersIncludeInheritedMembers
MoqProtectedExtensionMethodsProtectedExtensionClassSeeAlsoSendFeedback
TheProtectedExtensiontypeexposesthefollowingmembers.
![Page 1225: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1225.jpg)
Methods Name Description
Protected<(Of<<'(T>)>>) Enableprotectedsetupsforthemock.
![Page 1226: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1226.jpg)
SeeAlsoProtectedExtensionClassMoq.ProtectedNamespace
![Page 1227: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1227.jpg)
C#
MoqProtectedExtension..::..Protected<(Of<(<'T>)>)>MethodProtectedExtensionClassSeeAlsoSendFeedbackEnableprotectedsetupsforthemock.
Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)
![Page 1228: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1228.jpg)
SyntaxC#
publicstaticIProtectedMock<T>Protected<T>(
thisMock<T>mock
)
whereT:class
Parameters
mockType:Moq..::..Mock<(Of<(<'T>)>)>Themocktosettheprotectedsetupson.
![Page 1229: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1229.jpg)
TypeParametersT
Mockedobjecttype.Typicallyomittedasitcanbeinferredfromthemockinstance.
![Page 1230: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to](https://reader030.fdocuments.net/reader030/viewer/2022040619/5f2cc55707f3c305967636fc/html5/thumbnails/1230.jpg)
SeeAlsoProtectedExtensionClassMoq.ProtectedNamespace