+ All Categories
Home > Documents > C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just...

C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just...

Date post: 08-Jul-2020
Category:
Upload: others
View: 10 times
Download: 0 times
Share this document with a friend
1230
C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to take full advantage of .NET 3.5 (i.e. Linq expression trees) and C# 3.0 features (i.e. lambda expressions) that make it the most productive, simple and refactoring- friendly mocking library available. See the online quickstarts for more examples than those available in this code documentation. The Mock<T> class is the core of the library, so it's a good place to start. You can also read blog entries from around the world about Moq.
Transcript
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

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

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

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

Enumerations Enumeration Description

DefaultValue Determinesthewaydefaultvaluesaregeneratedcalculatedforloosemocks.

MockBehavior Optionstocustomizethebehaviorofthemock.

RangeKindofrangetouseinafilterspecifiedthroughIsInRange<(Of<<'(TValue>)>>)(TValue,TValue,Range).

[email protected]

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

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

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

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

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

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

RemarksThisclassallowsthesetuptomatchamethodinvocationwithanarbitraryvalue,withavalueinaspecifiedrange,orevenonethatmatchesagivenpredicate.

Page 12: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

InheritanceHierarchySystem..::..ObjectMoq..::..It

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

OverloadList Name Description

IsRegex(String) Matchesastringargumentifitmatchesthegivenregularexpressionpattern.

IsRegex(String,RegexOptions)

Matchesastringargumentifitmatchesthegivenregularexpressionpattern.

Page 37: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoItClassItMembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoItClassIsRegexOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoItClassIsRegexOverloadMoqNamespace

[email protected]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

SeeAlsoMockClassMockMembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockClassOfOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockClassOfOverloadMoqNamespace

[email protected]

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

C#

MoqMock..::..OnGetObjectMethodMockClassSeeAlsoSendFeedbackReturnsthemockedobjectvalue.

Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 86: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

protectedabstractObjectOnGetObject()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

C#

MoqMock..::..CallBasePropertyMockClassSeeAlsoSendFeedbackWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).

Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 109: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

publicvirtualboolCallBase{get;set;}

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

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

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

C#

MoqMock..::..ObjectPropertyMockClassSeeAlsoSendFeedbackGetsthemockedobjectinstance.

Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 115: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

publicObjectObject{get;}

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

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

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

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

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

<<'(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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>OverloadMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>OverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>OverloadMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>OverloadMoqNamespace

[email protected]

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

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

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

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

<<'(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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace

[email protected]

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

C#

MoqMock<(Of<(<'T>)>)>..::..OnGetObjectMethodMock<(Of<(<'T>)>)>ClassSeeAlsoSendFeedbackReturnsthemockedobjectvalue.

Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 163: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

protectedoverrideObjectOnGetObject()

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassRaiseOverloadMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassRaiseOverloadMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassSetupOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassSetupOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassSetupPropertyOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassSetupPropertyOverloadMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassSetupSetOverloadMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassSetupSetOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyOverloadMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyGetOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyGetOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifyGetOverloadMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMock<(Of<(<'T>)>)>MembersMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifySetOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifySetOverloadMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifySetOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassVerifySetOverloadMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMock<(Of<(<'T>)>)>ClassMoqNamespace

[email protected]

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

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

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

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

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

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

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

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

SeeAlsoMockExceptionMembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockExceptionClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockExceptionClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockExceptionClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockExceptionClassMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockExtensionsMembersMoqNamespace

[email protected]

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

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

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

SeeAlsoMockExtensionsClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockExtensionsClassMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockExtensionsClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockExtensionsClassMockExtensionsMembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockExtensionsClassVerifySetOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockExtensionsClassVerifySetOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockExtensionsClassVerifySetOverloadMoqNamespace

[email protected]

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

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

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

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

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

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

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

SeeAlsoMockFactoryMembersMoqNamespaceMoq..::..MockBehavior

[email protected]

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

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

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

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

Properties Name Description

CallBaseWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).

DefaultValue Specifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.

Mocks Getsthemocksthathavebeencreatedbythisfactoryandthatwillgetverifiedtogether.

Page 365: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

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

SyntaxC#

publicMockFactory(

MockBehaviordefaultBehavior

)

Parameters

defaultBehaviorType:Moq..::..MockBehaviorThebehaviortouseformockscreatedusingtheCreate<(Of<<'(T>)>>)()()()()factorymethodifnotoverridenbyusingtheCreate<(Of<<'(T>)>>)(MockBehavior)overload.

Page 368: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

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

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 371: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockFactoryClassMockFactoryMembersMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMockFactoryClassCreateOverloadMoqNamespace

[email protected]

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

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

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

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

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

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

SeeAlsoMockFactoryClassCreateOverloadMoqNamespace

[email protected]

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

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

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

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

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

SeeAlsoMockFactoryClassCreateOverloadMoqNamespace

[email protected]

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

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

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

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

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

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

SeeAlsoMockFactoryClassCreateOverloadMoqNamespace

[email protected]

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

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

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

TypeParametersT

Typetomock.

Page 400: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockFactoryClassMoqNamespaceMock..::..Verify()()()()

[email protected]

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

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

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

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

SeeAlsoMockFactoryClassMoqNamespaceMock..::..Verify()()()()

[email protected]

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

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

SyntaxC#

protectedvirtualvoidVerifyMocks(

Action<Mock>verifyAction

)

Parameters

verifyActionType:System..::..Action<(Of<(<'Mock>)>)>Theactiontoexecuteagainsteachmock.

Page 411: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

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

Properties Name Description

CallBaseWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).

DefaultValue Specifiesthebehaviortousewhenreturningdefaultvaluesforunexpectedinvocationsonloosemocks.

Mocks Getsthemocksthathavebeencreatedbythisfactoryandthatwillgetverifiedtogether.

Page 414: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

C#

MoqMockFactory..::..CallBasePropertyMockFactoryClassSeeAlsoSendFeedbackWhetherthebasemembervirtualimplementationwillbecalledformockedclassesifnosetupismatched.DefaultstofalseFalsefalsefalse(FalseinVisualBasic).

Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 416: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

publicboolCallBase{get;set;}

Page 417: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

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

SyntaxC#

publicDefaultValueDefaultValue{get;set;}

Page 420: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

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

SyntaxC#

protectedinternalIEnumerable<Mock>Mocks{get;}

Page 423: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMockFactoryClassMoqNamespace

[email protected]

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

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

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

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

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

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

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

SeeAlsoMockRepositoryMembersMoqNamespaceMoq..::..MockBehavior

[email protected]

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

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

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

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

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

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

SeeAlsoMockRepositoryClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockRepositoryClassMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockRepositoryClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockRepositoryClassMockRepositoryMembersMoqNamespace

[email protected]

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

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

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

SeeAlsoMockRepositoryClassMockRepositoryMembersMoqNamespace

[email protected]

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

C#

MoqMockRepository..::..Of<(Of<(<'T>)>)>MethodMockRepositoryClassSeeAlsoSendFeedbackAccesstheuniverseofmocksofthegiventype,toretrievethosethatbehaveaccordingtotheLINQqueryspecification.

Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 451: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

publicIQueryable<T>Of<T>()

whereT:class

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

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

SeeAlsoMockRepositoryClassOfOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockRepositoryClassOfOverloadMoqNamespace

[email protected]

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

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

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

SeeAlsoMockRepositoryClassMockRepositoryMembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockRepositoryClassOneOfOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockRepositoryClassOneOfOverloadMoqNamespace

[email protected]

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

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

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

SeeAlsoMockRepositoryClassMoqNamespace

[email protected]

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

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

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

InheritanceHierarchySystem..::..ObjectMoq..::..Mocks

Page 475: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoMocksMembersMoqNamespace

[email protected]

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

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

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

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

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

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

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

SeeAlsoMocksClassMocksMembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMocksClassOfOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMocksClassOfOverloadMoqNamespace

[email protected]

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

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

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

SeeAlsoMocksClassMocksMembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMocksClassOneOfOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMocksClassOneOfOverloadMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockSequenceMembersMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockSequenceClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockSequenceClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockSequenceClassMoqNamespace

[email protected]

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

C#

MoqMockSequence..::..CyclicPropertyMockSequenceClassSeeAlsoSendFeedbackAllowsequencetoberepeated

Namespace:MoqAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 519: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

publicboolCyclic{get;set;}

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

SeeAlsoMockSequenceClassMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockSequenceHelperMembersMoqNamespace

[email protected]

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

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

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

SeeAlsoMockSequenceHelperClassMoqNamespace

[email protected]

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

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

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

SeeAlsoMockSequenceHelperClassMoqNamespace

[email protected]

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

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

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

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

SeeAlsoMockSequenceHelperClassMoqNamespace

[email protected]

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

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

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

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

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

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

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

SeeAlsoSequenceExtensionsMembersMoqNamespace

[email protected]

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

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

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

SeeAlsoSequenceExtensionsClassMoqNamespace

[email protected]

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

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

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

SeeAlsoSequenceExtensionsClassMoqNamespace

[email protected]

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

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

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

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

SeeAlsoSequenceExtensionsClassMoqNamespace

[email protected]

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

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

SyntaxC#

publicstructTimes

Page 555: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesMembersMoqNamespace

[email protected]

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

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

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

Operators Name Description

Equality DetermineswhethertwospecifiedTimesobjectshavethesamevalue.

Inequality DetermineswhethertwospecifiedTimesobjectshavedifferentvalues.

Page 559: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

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 562: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticTimesAtLeast(

intcallCount

)

Parameters

callCountType:System..::..Int32Theminimunnumberoftimes.

ReturnValue

Anobjectdefiningtheallowednumberofinvocations.

Page 565: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticTimesAtLeastOnce()

ReturnValue

Anobjectdefiningtheallowednumberofinvocations.

Page 568: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticTimesAtMost(

intcallCount

)

Parameters

callCountType:System..::..Int32Themaximunnumberoftimes.

ReturnValue

Anobjectdefiningtheallowednumberofinvocations.

Page 571: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticTimesAtMostOnce()

ReturnValue

Anobjectdefiningtheallowednumberofinvocations.

Page 574: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticTimesBetween(

intcallCountFrom,

intcallCountTo,

RangerangeKind

)

Parameters

callCountFromType:System..::..Int32Theminimunnumberoftimes.

callCountToType:System..::..Int32Themaximunnumberoftimes.

rangeKindType:Moq..::..RangeThekindofrange.SeeRange.

ReturnValue

Anobjectdefiningtheallowednumberofinvocations.

Page 577: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicoverrideboolEquals(

Objectobj

)

Parameters

objType:System..::..ObjectTheObjecttocomparewiththisinstance.

ReturnValue

trueifthespecifiedObjectisequaltothisinstance;otherwise,false.

Page 580: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticTimesExactly(

intcallCount

)

Parameters

callCountType:System..::..Int32Thetimesthatamethodorpropertycanbecalled.

ReturnValue

Anobjectdefiningtheallowednumberofinvocations.

Page 583: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicoverrideintGetHashCode()

ReturnValue

Ahashcodeforthisinstance,suitableforuseinhashingalgorithmsanddatastructureslikeahashtable.

Page 586: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticTimesNever()

ReturnValue

Anobjectdefiningtheallowednumberofinvocations.

Page 589: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticTimesOnce()

ReturnValue

Anobjectdefiningtheallowednumberofinvocations.

Page 592: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

Operators Name Description

Equality DetermineswhethertwospecifiedTimesobjectshavethesamevalue.

Inequality DetermineswhethertwospecifiedTimesobjectshavedifferentvalues.

Page 595: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticbooloperator==(

Timesleft,

Timesright

)

Parameters

leftType:Moq..::..TimesThefirstTimes.

rightType:Moq..::..TimesThesecondTimes.

ReturnValue

trueifthevalueofleftisthesameasthevalueofright;otherwise,false.

Page 598: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

SyntaxC#

publicstaticbooloperator!=(

Timesleft,

Timesright

)

Parameters

leftType:Moq..::..TimesThefirstTimes.

rightType:Moq..::..TimesThesecondTimes.

ReturnValue

trueifthevalueofleftisdifferentfromthevalueofright;otherwise,false.

Page 601: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SeeAlsoTimesStructureMoqNamespace

[email protected]

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

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

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.

[email protected]

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

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

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

SeeAlsoICallbackMembersMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceICallbackMembersMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallbackInterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceICallback<(Of<(<'TMock,TResult>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoICallback<(Of<(<'TMock,TResult>)>)>InterfaceCallbackOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackGetter<(Of<(<'TMock,TProperty>)>)>MembersMoq.LanguageNamespaceMockSetupGet``1(Expression<(Of<<'(Func<(Of<<'(UTP,UMP>)>>)>)>>))

[email protected]

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

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

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

SeeAlsoICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackSetter<(Of<(<'TProperty>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoICallbackSetter<(Of<(<'TProperty>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoICallbackSetter<(Of<(<'TProperty>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoICallbackSetter<(Of<(<'TProperty>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

<<'(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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

<<'(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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceIRaise<(Of<(<'T>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespaceIRaise<(Of<(<'T>)>)>..::..Raises(Action<(Of<<'(T>)>>),EventArgs)

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIRaise<(Of<(<'T>)>)>InterfaceRaisesOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceIReturns<(Of<(<'TMock,TResult>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturns<(Of<(<'TMock,TResult>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceIReturnsGetter<(Of<(<'TMock,TProperty>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIReturnsGetter<(Of<(<'TMock,TProperty>)>)>InterfaceReturnsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceISetupConditionResult<(Of<(<'T>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceSetupOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceSetupOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceISetupConditionResult<(Of<(<'T>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceSetupSetOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoISetupConditionResult<(Of<(<'T>)>)>InterfaceSetupSetOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceISetupSequentialResult<(Of<(<'TResult>)>)>MembersMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceThrowsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoISetupSequentialResult<(Of<(<'TResult>)>)>InterfaceThrowsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIThrowsMembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIThrowsInterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIThrowsInterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIThrowsInterfaceIThrowsMembersMoq.LanguageNamespace

[email protected]

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

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

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

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

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

SeeAlsoIThrowsInterfaceThrowsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIThrowsInterfaceThrowsOverloadMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIVerifiesMembersMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIVerifiesInterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIVerifiesInterfaceMoq.LanguageNamespace

[email protected]

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

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

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

SeeAlsoIVerifiesInterfaceIVerifiesMembersMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIVerifiesInterfaceVerifiableOverloadMoq.LanguageNamespace

[email protected]

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

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

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

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

SeeAlsoIVerifiesInterfaceVerifiableOverloadMoq.LanguageNamespace

[email protected]

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

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

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

Interfaces Interface Description

IProtectedMock<(Of<(<'TMock>)>)>

Allowssetupstobespecifiedforprotectedmembersbyusingtheirnameasastring,ratherthanstrong-typingthemwhichisnotpossibleduetotheirvisibility.

[email protected]

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

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>MembersMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceIProtectedMock<(Of<(<'TMock>)>)>MembersMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceSetupOverloadMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceSetupOverloadMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceIProtectedMock<(Of<(<'TMock>)>)>MembersMoq.ProtectedNamespace

[email protected]

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

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

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceVerifyOverloadMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceVerifyOverloadMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace

[email protected]

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

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

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

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

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

SeeAlsoIProtectedMock<(Of<(<'TMock>)>)>InterfaceMoq.ProtectedNamespace

[email protected]

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

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

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

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

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

SeeAlsoItExprMembersMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoItExprClassMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoItExprClassMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoItExprClassMoq.ProtectedNamespace

[email protected]

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

C#

MoqItExpr..::..IsAny<(Of<(<'TValue>)>)>MethodItExprClassExampleSeeAlsoSendFeedbackMatchesanyvalueofthegivenTValuetype.

Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 1190: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

publicstaticExpressionIsAny<TValue>()

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

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

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

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

SeeAlsoItExprClassMoq.ProtectedNamespace

[email protected]

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

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

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

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

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

SeeAlsoItExprClassMoq.ProtectedNamespace

[email protected]

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

C#

MoqItExpr..::..IsNull<(Of<(<'TValue>)>)>MethodItExprClassExampleSeeAlsoSendFeedbackMatchesanullvalueofthegivenTValuetype.

Namespace:Moq.ProtectedAssembly:Moq(inMoq.dll)Version:4.0.10827.0(4.0.0.0)

Page 1201: C# · C# Moq Moq Namespace Send Feedback Root namespace of Moq (pronounced "Mock-you" or just "Mock"), the only mocking library for .NET and Silverlight developed from scratch to

SyntaxC#

publicstaticExpressionIsNull<TValue>()

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

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

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

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

SeeAlsoItExprClassMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoItExprClassItExprMembersMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoItExprClassIsRegexOverloadMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoItExprClassIsRegexOverloadMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoProtectedExtensionMembersMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoProtectedExtensionClassMoq.ProtectedNamespace

[email protected]

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

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

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

SeeAlsoProtectedExtensionClassMoq.ProtectedNamespace

[email protected]

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

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

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

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

SeeAlsoProtectedExtensionClassMoq.ProtectedNamespace

[email protected]


Recommended