diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b6cf559
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,305 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+**/Properties/launchSettings.json
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Typescript v1 declaration files
+typings/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
\ No newline at end of file
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/License.txt b/RESW File Code Generator/packages/Moq.4.0.10827/License.txt
deleted file mode 100644
index 8b6bcf8..0000000
--- a/RESW File Code Generator/packages/Moq.4.0.10827/License.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-Copyright (c) 2007. Clarius Consulting, Manas Technology Solutions, InSTEDD
-http://code.google.com/p/moq/
-All rights reserved.
-
-Redistribution and use in source and binary forms,
-with or without modification, are permitted provided
-that the following conditions are met:
-
- * Redistributions of source code must retain the
- above copyright notice, this list of conditions and
- the following disclaimer.
-
- * Redistributions in binary form must reproduce
- the above copyright notice, this list of conditions
- and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- * Neither the name of Clarius Consulting, Manas Technology Solutions or InSTEDD nor the
- names of its contributors may be used to endorse
- or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-[This is the BSD license, see
- http://www.opensource.org/licenses/bsd-license.php]
\ No newline at end of file
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/Moq.4.0.10827.nupkg b/RESW File Code Generator/packages/Moq.4.0.10827/Moq.4.0.10827.nupkg
deleted file mode 100644
index 91e88a4..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/Moq.4.0.10827.nupkg and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/Moq.chm b/RESW File Code Generator/packages/Moq.4.0.10827/Moq.chm
deleted file mode 100644
index f5779bb..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/Moq.chm and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.dll b/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.dll
deleted file mode 100644
index 3d3b8cc..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.dll and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.pdb b/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.pdb
deleted file mode 100644
index b0eaa80..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.pdb and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.xml b/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.xml
deleted file mode 100644
index 4320775..0000000
--- a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET35/Moq.xml
+++ /dev/null
@@ -1,5768 +0,0 @@
-
-
-
- Moq
-
-
-
-
- Implements the fluent API.
-
-
-
-
- The expectation will be considered only in the former condition.
-
-
-
-
-
-
- The expectation will be considered only in the former condition.
-
-
-
-
-
-
-
- Setups the get.
-
- The type of the property.
- The expression.
-
-
-
-
- Setups the set.
-
- The type of the property.
- The setter expression.
-
-
-
-
- Setups the set.
-
- The setter expression.
-
-
-
-
- Defines the Callback verb and overloads.
-
-
-
-
- Helper interface used to hide the base
- members from the fluent API to make it much cleaner
- in Visual Studio intellisense.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Specifies a callback to invoke when the method is called.
-
- The callback method to invoke.
-
- The following example specifies a callback to set a boolean
- value that can be used later:
-
- var called = false;
- mock.Setup(x => x.Execute())
- .Callback(() => called = true);
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The argument type of the invoked method.
- The callback method to invoke.
-
- Invokes the given callback with the concrete invocation argument value.
-
- Notice how the specific string argument is retrieved by simply declaring
- it as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Callback((string command) => Console.WriteLine(command));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3) => Console.WriteLine(arg1 + arg2 + arg3));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16));
-
-
-
-
-
- Defines the Callback verb and overloads for callbacks on
- setups that return a value.
-
- Mocked type.
- Type of the return value of the setup.
-
-
-
- Specifies a callback to invoke when the method is called.
-
- The callback method to invoke.
-
- The following example specifies a callback to set a boolean value that can be used later:
-
- var called = false;
- mock.Setup(x => x.Execute())
- .Callback(() => called = true)
- .Returns(true);
-
- Note that in the case of value-returning methods, after the Callback
- call you can still specify the return value.
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the argument of the invoked method.
- Callback method to invoke.
-
- Invokes the given callback with the concrete invocation argument value.
-
- Notice how the specific string argument is retrieved by simply declaring
- it as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Callback(command => Console.WriteLine(command))
- .Returns(true);
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2) => Console.WriteLine(arg1 + arg2));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3) => Console.WriteLine(arg1 + arg2 + arg3));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- 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) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Defines the Raises verb.
-
-
-
-
- Specifies the event that will be raised
- when the setup is met.
-
- An expression that represents an event attach or detach action.
- The event arguments to pass for the raised event.
-
- The following example shows how to raise an event when
- the setup is met:
-
- var mock = new Mock<IContainer>();
-
- mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>()))
- .Raises(add => add.Added += null, EventArgs.Empty);
-
-
-
-
-
- Specifies the event that will be raised
- when the setup is matched.
-
- An expression that represents an event attach or detach action.
- A function that will build the
- to pass when raising the event.
-
-
-
-
- Specifies the custom event that will be raised
- when the setup is matched.
-
- An expression that represents an event attach or detach action.
- The arguments to pass to the custom delegate (non EventHandler-compatible).
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
- The type of the fifteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
- The type of the fifteenth argument received by the expected invocation.
- The type of the sixteenth argument received by the expected invocation.
-
-
-
-
- Defines the Returns verb.
-
- Mocked type.
- Type of the return value from the expression.
-
-
-
- Specifies the value to return.
-
- The value to return, or .
-
- Return a true value from the method call:
-
- mock.Setup(x => x.Execute("ping"))
- .Returns(true);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method.
-
- The function that will calculate the return value.
-
- Return a calculated value when the method is called:
-
- mock.Setup(x => x.Execute("ping"))
- .Returns(() => returnValues[0]);
-
- The lambda expression to retrieve the return value is lazy-executed,
- meaning that its value may change depending on the moment the method
- is executed and the value the returnValues array has at
- that moment.
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the argument of the invoked method.
- The function that will calculate the return value.
-
- Return a calculated value which is evaluated lazily at the time of the invocation.
-
- The lookup list can change between invocations and the setup
- will return different values accordingly. Also, notice how the specific
- string argument is retrieved by simply declaring it as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Returns((string command) => returnValues[command]);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2) => arg1 + arg2);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3) => arg1 + arg2 + arg3);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4) => arg1 + arg2 + arg3 + arg4);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5) => arg1 + arg2 + arg3 + arg4 + arg5);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16);
-
-
-
-
-
- Language for ReturnSequence
-
-
-
-
- Returns value
-
-
-
-
- Throws an exception
-
-
-
-
- Throws an exception
-
-
-
-
- The first method call or member access will be the
- last segment of the expression (depth-first traversal),
- which is the one we have to Setup rather than FluentMock.
- And the last one is the one we have to Mock.Get rather
- than FluentMock.
-
-
-
-
- Base class for mocks and static helper class with methods that
- apply to mocked objects, such as to
- retrieve a from an object instance.
-
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the specification of how the mocked object should behave.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Retrieves the mock object for the given object instance.
-
- Type of the mock to retrieve. Can be omitted as it's inferred
- from the object instance passed in as the instance.
- The instance of the mocked object.The mock associated with the mocked object.
- The received instance
- was not created by Moq.
-
- The following example shows how to add a new setup to an object
- instance which is not the original but rather
- the object associated with it:
-
- // Typed instance, not the mock, is retrieved from some test API.
- HttpContextBase context = GetMockContext();
-
- // context.Request is the typed object from the "real" API
- // so in order to add a setup to it, we need to get
- // the mock that "owns" it
- Mock<HttpRequestBase> request = Mock.Get(context.Request);
- mock.Setup(req => req.AppRelativeCurrentExecutionFilePath)
- .Returns(tempUrl);
-
-
-
-
-
- Returns the mocked object value.
-
-
-
-
- Verifies that all verifiable expectations have been met.
-
- This example sets up an expectation and marks it as verifiable. After
- the mock is used, a Verify() call is issued on the mock
- to ensure the method in the setup was invoked:
-
- var mock = new Mock<IWarehouse>();
- this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true);
- ...
- // other test code
- ...
- // Will throw if the test code has didn't call HasInventory.
- this.Verify();
-
- Not all verifiable expectations were met.
-
-
-
- Verifies all expectations regardless of whether they have
- been flagged as verifiable.
-
- This example sets up an expectation without marking it as verifiable. After
- the mock is used, a call is issued on the mock
- to ensure that all expectations are met:
-
- var mock = new Mock<IWarehouse>();
- this.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true);
- ...
- // other test code
- ...
- // Will throw if the test code has didn't call HasInventory, even
- // that expectation was not marked as verifiable.
- this.VerifyAll();
-
- At least one expectation was not met.
-
-
-
- Gets the interceptor target for the given expression and root mock,
- building the intermediate hierarchy of mock objects if necessary.
-
-
-
-
- Raises the associated event with the given
- event argument data.
-
-
-
-
- Raises the associated event with the given
- event argument data.
-
-
-
-
- Adds an interface implementation to the mock,
- allowing setups to be specified for it.
-
- This method can only be called before the first use
- of the mock property, at which
- point the runtime type has already been generated
- and no more interfaces can be added to it.
-
- Also, must be an
- interface and not a class, which must be specified
- when creating the mock instead.
-
-
- The mock type
- has already been generated by accessing the property.
-
- The specified
- is not an interface.
-
- The following example creates a mock for the main interface
- and later adds to it to verify
- it's called by the consumer code:
-
- var mock = new Mock<IProcessor>();
- mock.Setup(x => x.Execute("ping"));
-
- // add IDisposable interface
- var disposable = mock.As<IDisposable>();
- disposable.Setup(d => d.Dispose()).Verifiable();
-
- Type of interface to cast the mock to.
-
-
-
-
-
-
- Behavior of the mock, according to the value set in the constructor.
-
-
-
-
- Whether the base member virtual implementation will be called
- for mocked classes if no setup is matched. Defaults to .
-
-
-
-
- Specifies the behavior to use when returning default values for
- unexpected invocations on loose mocks.
-
-
-
-
- Gets the mocked object instance.
-
-
-
-
- Retrieves the type of the mocked object, its generic type argument.
- This is used in the auto-mocking of hierarchy access.
-
-
-
-
- Specifies the class that will determine the default
- value to return when invocations are made that
- have no setups and need to return a default
- value (for loose mocks).
-
-
-
-
- Exposes the list of extra interfaces implemented by the mock.
-
-
-
-
- Utility repository class to use to construct multiple
- mocks when consistent verification is
- desired for all of them.
-
-
- If multiple mocks will be created during a test, passing
- the desired (if different than the
- or the one
- passed to the repository constructor) and later verifying each
- mock can become repetitive and tedious.
-
- This repository class helps in that scenario by providing a
- simplified creation of multiple mocks with a default
- (unless overriden by calling
- ) and posterior verification.
-
-
-
- The following is a straightforward example on how to
- create and automatically verify strict mocks using a :
-
- var repository = new MockRepository(MockBehavior.Strict);
-
- var foo = repository.Create<IFoo>();
- var bar = repository.Create<IBar>();
-
- // no need to call Verifiable() on the setup
- // as we'll be validating all of them anyway.
- foo.Setup(f => f.Do());
- bar.Setup(b => b.Redo());
-
- // exercise the mocks here
-
- repository.VerifyAll();
- // At this point all setups are already checked
- // and an optional MockException might be thrown.
- // Note also that because the mocks are strict, any invocation
- // that doesn't have a matching setup will also throw a MockException.
-
- The following examples shows how to setup the repository
- to create loose mocks and later verify only verifiable setups:
-
- var repository = new MockRepository(MockBehavior.Loose);
-
- var foo = repository.Create<IFoo>();
- var bar = repository.Create<IBar>();
-
- // this setup will be verified when we verify the repository
- foo.Setup(f => f.Do()).Verifiable();
-
- // this setup will NOT be verified
- foo.Setup(f => f.Calculate());
-
- // this setup will be verified when we verify the repository
- bar.Setup(b => b.Redo()).Verifiable();
-
- // exercise the mocks here
- // note that because the mocks are Loose, members
- // called in the interfaces for which no matching
- // setups exist will NOT throw exceptions,
- // and will rather return default values.
-
- repository.Verify();
- // At this point verifiable setups are already checked
- // and an optional MockException might be thrown.
-
- The following examples shows how to setup the repository with a
- default strict behavior, overriding that default for a
- specific mock:
-
- var repository = new MockRepository(MockBehavior.Strict);
-
- // this particular one we want loose
- var foo = repository.Create<IFoo>(MockBehavior.Loose);
- var bar = repository.Create<IBar>();
-
- // specify setups
-
- // exercise the mocks here
-
- repository.Verify();
-
-
-
-
-
-
- Utility factory class to use to construct multiple
- mocks when consistent verification is
- desired for all of them.
-
-
- If multiple mocks will be created during a test, passing
- the desired (if different than the
- or the one
- passed to the factory constructor) and later verifying each
- mock can become repetitive and tedious.
-
- This factory class helps in that scenario by providing a
- simplified creation of multiple mocks with a default
- (unless overriden by calling
- ) and posterior verification.
-
-
-
- The following is a straightforward example on how to
- create and automatically verify strict mocks using a :
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>();
- var bar = factory.Create<IBar>();
-
- // no need to call Verifiable() on the setup
- // as we'll be validating all of them anyway.
- foo.Setup(f => f.Do());
- bar.Setup(b => b.Redo());
-
- // exercise the mocks here
-
- factory.VerifyAll();
- // At this point all setups are already checked
- // and an optional MockException might be thrown.
- // Note also that because the mocks are strict, any invocation
- // that doesn't have a matching setup will also throw a MockException.
-
- The following examples shows how to setup the factory
- to create loose mocks and later verify only verifiable setups:
-
- var factory = new MockFactory(MockBehavior.Loose);
-
- var foo = factory.Create<IFoo>();
- var bar = factory.Create<IBar>();
-
- // this setup will be verified when we verify the factory
- foo.Setup(f => f.Do()).Verifiable();
-
- // this setup will NOT be verified
- foo.Setup(f => f.Calculate());
-
- // this setup will be verified when we verify the factory
- bar.Setup(b => b.Redo()).Verifiable();
-
- // exercise the mocks here
- // note that because the mocks are Loose, members
- // called in the interfaces for which no matching
- // setups exist will NOT throw exceptions,
- // and will rather return default values.
-
- factory.Verify();
- // At this point verifiable setups are already checked
- // and an optional MockException might be thrown.
-
- The following examples shows how to setup the factory with a
- default strict behavior, overriding that default for a
- specific mock:
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- // this particular one we want loose
- var foo = factory.Create<IFoo>(MockBehavior.Loose);
- var bar = factory.Create<IBar>();
-
- // specify setups
-
- // exercise the mocks here
-
- factory.Verify();
-
-
-
-
-
-
- Initializes the factory with the given
- for newly created mocks from the factory.
-
- The behavior to use for mocks created
- using the factory method if not overriden
- by using the overload.
-
-
-
- Creates a new mock with the default
- specified at factory construction time.
-
- Type to mock.
- A new .
-
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>();
- // use mock on tests
-
- factory.VerifyAll();
-
-
-
-
-
- Creates a new mock with the default
- specified at factory construction time and with the
- the given constructor arguments for the class.
-
-
- The mock will try to find the best match constructor given the
- constructor arguments, and invoke that to initialize the instance.
- This applies only to classes, not interfaces.
-
- Type to mock.
- Constructor arguments for mocked classes.
- A new .
-
-
- var factory = new MockFactory(MockBehavior.Default);
-
- var mock = factory.Create<MyBase>("Foo", 25, true);
- // use mock on tests
-
- factory.Verify();
-
-
-
-
-
- Creates a new mock with the given .
-
- Type to mock.
- Behavior to use for the mock, which overrides
- the default behavior specified at factory construction time.
- A new .
-
- The following example shows how to create a mock with a different
- behavior to that specified as the default for the factory:
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>(MockBehavior.Loose);
-
-
-
-
-
- Creates a new mock with the given
- and with the the given constructor arguments for the class.
-
-
- The mock will try to find the best match constructor given the
- constructor arguments, and invoke that to initialize the instance.
- This applies only to classes, not interfaces.
-
- Type to mock.
- Behavior to use for the mock, which overrides
- the default behavior specified at factory construction time.
- Constructor arguments for mocked classes.
- A new .
-
- The following example shows how to create a mock with a different
- behavior to that specified as the default for the factory, passing
- constructor arguments:
-
- var factory = new MockFactory(MockBehavior.Default);
-
- var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true);
-
-
-
-
-
- Implements creation of a new mock within the factory.
-
- Type to mock.
- The behavior for the new mock.
- Optional arguments for the construction of the mock.
-
-
-
- Verifies all verifiable expectations on all mocks created
- by this factory.
-
-
- One or more mocks had expectations that were not satisfied.
-
-
-
- Verifies all verifiable expectations on all mocks created
- by this factory.
-
-
- One or more mocks had expectations that were not satisfied.
-
-
-
- Invokes for each mock
- in , and accumulates the resulting
- that might be
- thrown from the action.
-
- The action to execute against
- each mock.
-
-
-
- Whether the base member virtual implementation will be called
- for mocked classes if no setup is matched. Defaults to .
-
-
-
-
- Specifies the behavior to use when returning default values for
- unexpected invocations on loose mocks.
-
-
-
-
- Gets the mocks that have been created by this factory and
- that will get verified together.
-
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The type of the mocked object to query.
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The predicate with the setup expressions.
- The type of the mocked object to query.
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the setup expressions.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates the mock query with the underlying queriable implementation.
-
-
-
-
- Wraps the enumerator inside a queryable.
-
-
-
-
- Method that is turned into the actual call from .Query{T}, to
- transform the queryable query into a normal enumerable query.
- This method is never used directly by consumers.
-
-
-
-
- Initializes the repository with the given
- for newly created mocks from the repository.
-
- The behavior to use for mocks created
- using the repository method if not overriden
- by using the overload.
-
-
-
- A that returns an empty default value
- for invocations that do not have setups or return values, with loose mocks.
- This is the default behavior for a mock.
-
-
-
-
- Interface to be implemented by classes that determine the
- default value of non-expected invocations.
-
-
-
-
- Defines the default value to return in all the methods returning .
- The type of the return value.The value to set as default.
-
-
-
- Provides a value for the given member and arguments.
-
- The member to provide a default value for.
-
-
-
-
- The intention of is to create a more readable
- string representation for the failure message.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Throws verb.
-
-
-
-
- Specifies the exception to throw when the method is invoked.
-
- Exception instance to throw.
-
- This example shows how to throw an exception when the method is
- invoked with an empty string argument:
-
- mock.Setup(x => x.Execute(""))
- .Throws(new ArgumentException());
-
-
-
-
-
- Specifies the type of exception to throw when the method is invoked.
-
- Type of exception to instantiate and throw when the setup is matched.
-
- This example shows how to throw an exception when the method is
- invoked with an empty string argument:
-
- mock.Setup(x => x.Execute(""))
- .Throws<ArgumentException>();
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines occurrence members to constraint setups.
-
-
-
-
- The expected invocation can happen at most once.
-
-
-
- var mock = new Mock<ICommand>();
- mock.Setup(foo => foo.Execute("ping"))
- .AtMostOnce();
-
-
-
-
-
- The expected invocation can happen at most specified number of times.
-
- The number of times to accept calls.
-
-
- var mock = new Mock<ICommand>();
- mock.Setup(foo => foo.Execute("ping"))
- .AtMost( 5 );
-
-
-
-
-
- Defines the Verifiable verb.
-
-
-
-
- Marks the expectation as verifiable, meaning that a call
- to will check if this particular
- expectation was met.
-
-
- The following example marks the expectation as verifiable:
-
- mock.Expect(x => x.Execute("ping"))
- .Returns(true)
- .Verifiable();
-
-
-
-
-
- Marks the expectation as verifiable, meaning that a call
- to will check if this particular
- expectation was met, and specifies a message for failures.
-
-
- The following example marks the expectation as verifiable:
-
- mock.Expect(x => x.Execute("ping"))
- .Returns(true)
- .Verifiable("Ping should be executed always!");
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- We need this non-generics base class so that
- we can use from
- generic code.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb for property getter setups.
-
-
- Mocked type.
- Type of the property.
-
-
-
- Specifies a callback to invoke when the property is retrieved.
-
- Callback method to invoke.
-
- Invokes the given callback with the property value being set.
-
- mock.SetupGet(x => x.Suspended)
- .Callback(() => called = true)
- .Returns(true);
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Returns verb for property get setups.
-
- Mocked type.
- Type of the property.
-
-
-
- Specifies the value to return.
-
- The value to return, or .
-
- Return a true value from the property getter call:
-
- mock.SetupGet(x => x.Suspended)
- .Returns(true);
-
-
-
-
-
- Specifies a function that will calculate the value to return for the property.
-
- The function that will calculate the return value.
-
- Return a calculated value when the property is retrieved:
-
- mock.SetupGet(x => x.Suspended)
- .Returns(() => returnValues[0]);
-
- The lambda expression to retrieve the return value is lazy-executed,
- meaning that its value may change depending on the moment the property
- is retrieved and the value the returnValues array has at
- that moment.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Encapsulates a method that has five parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has five parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has six parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has six parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has seven parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has seven parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has eight parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has eight parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has nine parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has nine parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has ten parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has ten parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has eleven parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has eleven parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has twelve parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has twelve parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has thirteen parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the thirteenth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The thirteenth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has thirteen parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the thirteenth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The thirteenth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has fourteen parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the thirteenth parameter of the method that this delegate encapsulates.
- The type of the fourteenth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The thirteenth parameter of the method that this delegate encapsulates.
- The fourteenth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has fourteen parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the thirteenth parameter of the method that this delegate encapsulates.
- The type of the fourteenth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The thirteenth parameter of the method that this delegate encapsulates.
- The fourteenth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has fifteen parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the thirteenth parameter of the method that this delegate encapsulates.
- The type of the fourteenth parameter of the method that this delegate encapsulates.
- The type of the fifteenth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The thirteenth parameter of the method that this delegate encapsulates.
- The fourteenth parameter of the method that this delegate encapsulates.
- The fifteenth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has fifteen parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the thirteenth parameter of the method that this delegate encapsulates.
- The type of the fourteenth parameter of the method that this delegate encapsulates.
- The type of the fifteenth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The thirteenth parameter of the method that this delegate encapsulates.
- The fourteenth parameter of the method that this delegate encapsulates.
- The fifteenth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has sixteen parameters and does not return a value.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the thirteenth parameter of the method that this delegate encapsulates.
- The type of the fourteenth parameter of the method that this delegate encapsulates.
- The type of the fifteenth parameter of the method that this delegate encapsulates.
- The type of the sixteenth parameter of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The thirteenth parameter of the method that this delegate encapsulates.
- The fourteenth parameter of the method that this delegate encapsulates.
- The fifteenth parameter of the method that this delegate encapsulates.
- The sixteenth parameter of the method that this delegate encapsulates.
-
-
-
- Encapsulates a method that has sixteen parameters and returns a value of the type specified by the parameter.
-
- The type of the first parameter of the method that this delegate encapsulates.
- The type of the second parameter of the method that this delegate encapsulates.
- The type of the third parameter of the method that this delegate encapsulates.
- The type of the fourth parameter of the method that this delegate encapsulates.
- The type of the fifth parameter of the method that this delegate encapsulates.
- The type of the sixth parameter of the method that this delegate encapsulates.
- The type of the seventh parameter of the method that this delegate encapsulates.
- The type of the eighth parameter of the method that this delegate encapsulates.
- The type of the nineth parameter of the method that this delegate encapsulates.
- The type of the tenth parameter of the method that this delegate encapsulates.
- The type of the eleventh parameter of the method that this delegate encapsulates.
- The type of the twelfth parameter of the method that this delegate encapsulates.
- The type of the thirteenth parameter of the method that this delegate encapsulates.
- The type of the fourteenth parameter of the method that this delegate encapsulates.
- The type of the fifteenth parameter of the method that this delegate encapsulates.
- The type of the sixteenth parameter of the method that this delegate encapsulates.
- The type of the return value of the method that this delegate encapsulates.
- The first parameter of the method that this delegate encapsulates.
- The second parameter of the method that this delegate encapsulates.
- The third parameter of the method that this delegate encapsulates.
- The fourth parameter of the method that this delegate encapsulates.
- The fifth parameter of the method that this delegate encapsulates.
- The sixth parameter of the method that this delegate encapsulates.
- The seventh parameter of the method that this delegate encapsulates.
- The eighth parameter of the method that this delegate encapsulates.
- The nineth parameter of the method that this delegate encapsulates.
- The tenth parameter of the method that this delegate encapsulates.
- The eleventh parameter of the method that this delegate encapsulates.
- The twelfth parameter of the method that this delegate encapsulates.
- The thirteenth parameter of the method that this delegate encapsulates.
- The fourteenth parameter of the method that this delegate encapsulates.
- The fifteenth parameter of the method that this delegate encapsulates.
- The sixteenth parameter of the method that this delegate encapsulates.
- The return value of the method that this delegate encapsulates.
-
-
-
- Helper class to setup a full trace between many mocks
-
-
-
-
- Initialize a trace setup
-
-
-
-
- Allow sequence to be repeated
-
-
-
-
- define nice api
-
-
-
-
- Perform an expectation in the trace.
-
-
-
-
- Marks a method as a matcher, which allows complete replacement
- of the built-in class with your own argument
- matching rules.
-
-
- This feature has been deprecated in favor of the new
- and simpler .
-
-
- The argument matching is used to determine whether a concrete
- invocation in the mock matches a given setup. This
- matching mechanism is fully extensible.
-
-
- There are two parts of a matcher: the compiler matcher
- and the runtime matcher.
-
- -
- Compiler matcher
- Used to satisfy the compiler requirements for the
- argument. Needs to be a method optionally receiving any arguments
- you might need for the matching, but with a return type that
- matches that of the argument.
-
- Let's say I want to match a lists of orders that contains
- a particular one. I might create a compiler matcher like the following:
-
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return null;
- }
- }
-
- Now we can invoke this static method instead of an argument in an
- invocation:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
- Note that the return value from the compiler matcher is irrelevant.
- This method will never be called, and is just used to satisfy the
- compiler and to signal Moq that this is not a method that we want
- to be invoked at runtime.
-
-
- -
- Runtime matcher
-
- The runtime matcher is the one that will actually perform evaluation
- when the test is run, and is defined by convention to have the
- same signature as the compiler matcher, but where the return
- value is the first argument to the call, which contains the
- object received by the actual invocation at runtime:
-
- public static bool Contains(IEnumerable<Order> orders, Order order)
- {
- return orders.Contains(order);
- }
-
- At runtime, the mocked method will be invoked with a specific
- list of orders. This value will be passed to this runtime
- matcher as the first argument, while the second argument is the
- one specified in the setup (x.Save(Orders.Contains(order))).
-
- The boolean returned determines whether the given argument has been
- matched. If all arguments to the expected method are matched, then
- the setup matches and is evaluated.
-
-
-
-
-
- Using this extensible infrastructure, you can easily replace the entire
- set of matchers with your own. You can also avoid the
- typical (and annoying) lengthy expressions that result when you have
- multiple arguments that use generics.
-
-
- The following is the complete example explained above:
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return null;
- }
-
- public static bool Contains(IEnumerable<Order> orders, Order order)
- {
- return orders.Contains(order);
- }
- }
-
- And the concrete test using this matcher:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
- // use mock, invoke Save, and have the matcher filter.
-
-
-
-
-
- Provides a mock implementation of .
-
- Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked.
-
- The behavior of the mock with regards to the setups and the actual calls is determined
- by the optional that can be passed to the
- constructor.
-
- Type to mock, which can be an interface or a class.
- The following example shows establishing setups with specific values
- for method invocations:
-
- // Arrange
- var order = new Order(TALISKER, 50);
- var mock = new Mock<IWarehouse>();
-
- mock.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true);
-
- // Act
- order.Fill(mock.Object);
-
- // Assert
- Assert.True(order.IsFilled);
-
- The following example shows how to use the class
- to specify conditions for arguments instead of specific values:
-
- // Arrange
- var order = new Order(TALISKER, 50);
- var mock = new Mock<IWarehouse>();
-
- // shows how to expect a value within a range
- mock.Setup(x => x.HasInventory(
- It.IsAny<string>(),
- It.IsInRange(0, 100, Range.Inclusive)))
- .Returns(false);
-
- // shows how to throw for unexpected calls.
- mock.Setup(x => x.Remove(
- It.IsAny<string>(),
- It.IsAny<int>()))
- .Throws(new InvalidOperationException());
-
- // Act
- order.Fill(mock.Object);
-
- // Assert
- Assert.False(order.IsFilled);
-
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Ctor invoked by AsTInterface exclusively.
-
-
-
-
- Initializes an instance of the mock with default behavior.
-
- var mock = new Mock<IFormatProvider>();
-
-
-
-
- Initializes an instance of the mock with default behavior and with
- the given constructor arguments for the class. (Only valid when is a class)
-
- The mock will try to find the best match constructor given the constructor arguments, and invoke that
- to initialize the instance. This applies only for classes, not interfaces.
-
- var mock = new Mock<MyProvider>(someArgument, 25);
- Optional constructor arguments if the mocked type is a class.
-
-
-
- Initializes an instance of the mock with the specified behavior.
-
- var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed);
- Behavior of the mock.
-
-
-
- Initializes an instance of the mock with a specific behavior with
- the given constructor arguments for the class.
-
- The mock will try to find the best match constructor given the constructor arguments, and invoke that
- to initialize the instance. This applies only to classes, not interfaces.
-
- var mock = new Mock<MyProvider>(someArgument, 25);
- Behavior of the mock.Optional constructor arguments if the mocked type is a class.
-
-
-
- Returns the mocked object value.
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a void method.
-
- If more than one setup is specified for the same method or property,
- the latest one wins and is the one that will be executed.
- Lambda expression that specifies the expected method invocation.
-
- var mock = new Mock<IProcessor>();
- mock.Setup(x => x.Execute("ping"));
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a value returning method.
- Type of the return value. Typically omitted as it can be inferred from the expression.
- If more than one setup is specified for the same method or property,
- the latest one wins and is the one that will be executed.
- Lambda expression that specifies the method invocation.
-
- mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property getter.
-
- If more than one setup is set for the same property getter,
- the latest one wins and is the one that will be executed.
- Type of the property. Typically omitted as it can be inferred from the expression.Lambda expression that specifies the property getter.
-
- mock.SetupGet(x => x.Suspended)
- .Returns(true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter.
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
-
- This overloads allows the use of a callback already
- typed for the property type.
-
- Type of the property. Typically omitted as it can be inferred from the expression.The Lambda expression that sets a property to a value.
-
- mock.SetupSet(x => x.Suspended = true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter.
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
- Lambda expression that sets a property to a value.
-
- mock.SetupSet(x => x.Suspended = true);
-
-
-
-
-
- Specifies that the given property should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. (this is also
- known as "stubbing").
-
- Type of the property, inferred from the property
- expression (does not need to be specified).
- Property expression to stub.
- If you have an interface with an int property Value, you might
- stub it using the following straightforward call:
-
- var mock = new Mock<IHaveValue>();
- mock.Stub(v => v.Value);
-
- After the Stub call has been issued, setting and
- retrieving the object value will behave as expected:
-
- IHaveValue v = mock.Object;
-
- v.Value = 5;
- Assert.Equal(5, v.Value);
-
-
-
-
-
- Specifies that the given property should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. This overload
- allows setting the initial value for the property. (this is also
- known as "stubbing").
-
- Type of the property, inferred from the property
- expression (does not need to be specified).
- Property expression to stub.Initial value for the property.
- If you have an interface with an int property Value, you might
- stub it using the following straightforward call:
-
- var mock = new Mock<IHaveValue>();
- mock.SetupProperty(v => v.Value, 5);
-
- After the SetupProperty call has been issued, setting and
- retrieving the object value will behave as expected:
-
- IHaveValue v = mock.Object;
- // Initial value was stored
- Assert.Equal(5, v.Value);
-
- // New value set which changes the initial value
- v.Value = 6;
- Assert.Equal(6, v.Value);
-
-
-
-
-
- Specifies that the all properties on the mock should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. (this is also
- known as "stubbing"). The default value for each property will be the
- one generated as specified by the property for the mock.
-
- If the mock is set to ,
- the mocked default values will also get all properties setup recursively.
-
-
-
-
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IProcessor>();
- // exercise mock
- //...
- // Will throw if the test code didn't call Execute with a "ping" string argument.
- mock.Verify(proc => proc.Execute("ping"));
-
- The invocation was not performed on the mock.Expression to verify.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock,
- specifying a failure error message. Use in conjuntion with the default
- .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IProcessor>();
- // exercise mock
- //...
- // Will throw if the test code didn't call Execute with a "ping" string argument.
- mock.Verify(proc => proc.Execute("ping"));
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock,
- specifying a failure error message. Use in conjuntion with the default
- .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't call HasInventory.
- mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50));
-
- The invocation was not performed on the mock.Expression to verify.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock. Use in conjuntion
- with the default .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock, specifying a failure
- error message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't call HasInventory.
- mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50), "When filling orders, inventory has to be checked");
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock, specifying a failure
- error message.
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.Type of return value from the expression.
-
-
-
- Verifies that a property was read on the mock.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was retrieved from it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't retrieve the IsClosed property.
- mock.VerifyGet(warehouse => warehouse.IsClosed);
-
- The invocation was not performed on the mock.Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock, specifying a failure
- error message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was retrieved from it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't retrieve the IsClosed property.
- mock.VerifyGet(warehouse => warehouse.IsClosed);
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock, specifying a failure
- error message.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was set on the mock.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was set on it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed = true);
-
- The invocation was not performed on the mock.Expression to verify.
-
-
-
- Verifies that a property was set on the mock.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.
-
-
-
- Verifies that a property was set on the mock, specifying
- a failure message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was set on it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action");
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
-
-
-
- Verifies that a property was set on the mock, specifying
- a failure message.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails.
-
-
-
- Raises the event referenced in using
- the given argument.
-
- The argument is
- invalid for the target event invocation, or the is
- not an event attach or detach expression.
-
- The following example shows how to raise a event:
-
- var mock = new Mock<IViewModel>();
-
- mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name"));
-
-
- This example shows how to invoke an event with a custom event arguments
- class in a view that will cause its corresponding presenter to
- react by changing its state:
-
- var mockView = new Mock<IOrdersView>();
- var presenter = new OrdersPresenter(mockView.Object);
-
- // Check that the presenter has no selection by default
- Assert.Null(presenter.SelectedOrder);
-
- // Raise the event with a specific arguments data
- mockView.Raise(v => v.SelectionChanged += null, new OrderEventArgs { Order = new Order("moq", 500) });
-
- // Now the presenter reacted to the event, and we have a selected order
- Assert.NotNull(presenter.SelectedOrder);
- Assert.Equal("moq", presenter.SelectedOrder.ProductName);
-
-
-
-
-
- Raises the event referenced in using
- the given argument for a non-EventHandler typed event.
-
- The arguments are
- invalid for the target event invocation, or the is
- not an event attach or detach expression.
-
- The following example shows how to raise a custom event that does not adhere to
- the standard EventHandler:
-
- var mock = new Mock<IViewModel>();
-
- mock.Raise(x => x.MyEvent -= null, "Name", bool, 25);
-
-
-
-
-
- Exposes the mocked object instance.
-
-
-
-
- Provides legacy API members as extensions so that
- existing code continues to compile, but new code
- doesn't see then.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Provides additional methods on mocks.
-
-
- Provided as extension methods as they confuse the compiler
- with the overloads taking Action.
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter, regardless of its value.
-
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
-
- Type of the property. Typically omitted as it can be inferred from the expression.
- Type of the mock.
- The target mock for the setup.
- Lambda expression that specifies the property setter.
-
-
- mock.SetupSet(x => x.Suspended);
-
-
-
- This method is not legacy, but must be on an extension method to avoid
- confusing the compiler with the new Action syntax.
-
-
-
-
- Verifies that a property has been set on the mock, regarless of its value.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- Expression to verify.
- The mock instance.
- Mocked type.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, specifying a failure
- error message.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- Expression to verify.
- Message to show if verification fails.
- The mock instance.
- Mocked type.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, regardless
- of the value but only the specified number of times.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- The invocation was not call the times specified by
- .
- The mock instance.
- Mocked type.
- The number of times a method is allowed to be called.
- Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, regardless
- of the value but only the specified number of times, and specifying a failure
- error message.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- The invocation was not call the times specified by
- .
- The mock instance.
- Mocked type.
- The number of times a method is allowed to be called.
- Message to show if verification fails.
- Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Helper for sequencing return values in the same method.
-
-
-
-
- Return a sequence of values, once per call.
-
-
-
-
- Casts the expression to a lambda expression, removing
- a cast if there's any.
-
-
-
-
- Casts the body of the lambda expression to a .
-
- If the body is not a method call.
-
-
-
- Converts the body of the lambda expression into the referenced by it.
-
-
-
-
- Checks whether the body of the lambda expression is a property access.
-
-
-
-
- Checks whether the expression is a property access.
-
-
-
-
- Checks whether the body of the lambda expression is a property indexer, which is true
- when the expression is an whose
- has
- equal to .
-
-
-
-
- Checks whether the expression is a property indexer, which is true
- when the expression is an whose
- has
- equal to .
-
-
-
-
- Creates an expression that casts the given expression to the
- type.
-
-
-
-
- TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583
- is fixed.
-
-
-
-
- Provides partial evaluation of subtrees, whenever they can be evaluated locally.
-
- Matt Warren: http://blogs.msdn.com/mattwar
- Documented by InSTEDD: http://www.instedd.org
-
-
-
- Performs evaluation and replacement of independent sub-trees
-
- The root of the expression tree.
- A function that decides whether a given expression
- node can be part of the local function.
- A new tree with sub-trees evaluated and replaced.
-
-
-
- Performs evaluation and replacement of independent sub-trees
-
- The root of the expression tree.
- A new tree with sub-trees evaluated and replaced.
-
-
-
- Evaluates and replaces sub-trees when first candidate is reached (top-down)
-
-
-
-
- Performs bottom-up analysis to determine which nodes can possibly
- be part of an evaluated sub-tree.
-
-
-
-
- Ensures the given is not null.
- Throws otherwise.
-
-
-
-
- Ensures the given string is not null or empty.
- Throws in the first case, or
- in the latter.
-
-
-
-
- Checks an argument to ensure it is in the specified range including the edges.
-
- Type of the argument to check, it must be an type.
-
- The expression containing the name of the argument.
- The argument value to check.
- The minimun allowed value for the argument.
- The maximun allowed value for the argument.
-
-
-
- Checks an argument to ensure it is in the specified range excluding the edges.
-
- Type of the argument to check, it must be an type.
-
- The expression containing the name of the argument.
- The argument value to check.
- The minimun allowed value for the argument.
- The maximun allowed value for the argument.
-
-
-
- Implemented by all generated mock object instances.
-
-
-
-
- Implemented by all generated mock object instances.
-
-
-
-
- Reference the Mock that contains this as the mock.Object value.
-
-
-
-
- Reference the Mock that contains this as the mock.Object value.
-
-
-
-
- Implements the actual interception and method invocation for
- all mocks.
-
-
-
-
- Get an eventInfo for a given event name. Search type ancestors depth first if necessary.
-
- Name of the event, with the set_ or get_ prefix already removed
-
-
-
- Given a type return all of its ancestors, both types and interfaces.
-
- The type to find immediate ancestors of
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb for property setter setups.
-
- Type of the property.
-
-
-
- Specifies a callback to invoke when the property is set that receives the
- property value being set.
-
- Callback method to invoke.
-
- Invokes the given callback with the property value being set.
-
- mock.SetupSet(x => x.Suspended)
- .Callback((bool state) => Console.WriteLine(state));
-
-
-
-
-
- Allows the specification of a matching condition for an
- argument in a method invocation, rather than a specific
- argument value. "It" refers to the argument being matched.
-
- This class allows the setup to match a method invocation
- with an arbitrary value, with a value in a specified range, or
- even one that matches a given predicate.
-
-
-
-
- Matches any value of the given type.
-
- Typically used when the actual argument value for a method
- call is not relevant.
-
-
- // Throws an exception for a call to Remove with any string value.
- mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException());
-
- Type of the value.
-
-
-
- Matches any value that satisfies the given predicate.
- Type of the argument to check.The predicate used to match the method argument.
- Allows the specification of a predicate to perform matching
- of method call arguments.
-
- This example shows how to return the value 1 whenever the argument to the
- Do method is an even number.
-
- mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0)))
- .Returns(1);
-
- This example shows how to throw an exception if the argument to the
- method is a negative number:
-
- mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0)))
- .Throws(new ArgumentException());
-
-
-
-
-
- Matches any value that is in the range specified.
- Type of the argument to check.The lower bound of the range.The upper bound of the range.
- The kind of range. See .
-
- The following example shows how to expect a method call
- with an integer argument within the 0..100 range.
-
- mock.Setup(x => x.HasInventory(
- It.IsAny<string>(),
- It.IsInRange(0, 100, Range.Inclusive)))
- .Returns(false);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
- The pattern to use to match the string argument value.
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression:
-
- mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
- The pattern to use to match the string argument value.The options used to interpret the pattern.
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression, in a case insensitive way:
-
- mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1);
-
-
-
-
-
- Matcher to treat static functions as matchers.
-
- mock.Setup(x => x.StringMethod(A.MagicString()));
-
- public static class A
- {
- [Matcher]
- public static string MagicString() { return null; }
- public static bool MagicString(string arg)
- {
- return arg == "magic";
- }
- }
-
- Will succeed if: mock.Object.StringMethod("magic");
- and fail with any other call.
-
-
-
-
- Options to customize the behavior of the mock.
-
-
-
-
- Causes the mock to always throw
- an exception for invocations that don't have a
- corresponding setup.
-
-
-
-
- Will never throw exceptions, returning default
- values when necessary (null for reference types,
- zero for value types or empty enumerables and arrays).
-
-
-
-
- Default mock behavior, which equals .
-
-
-
-
- Exception thrown by mocks when setups are not matched,
- the mock is not properly setup, etc.
-
-
- A distinct exception type is provided so that exceptions
- thrown by the mock can be differentiated in tests that
- expect other exceptions to be thrown (i.e. ArgumentException).
-
- Richer exception hierarchy/types are not provided as
- tests typically should not catch or expect exceptions
- from the mocks. These are typically the result of changes
- in the tested class or its collaborators implementation, and
- result in fixes in the mock setup so that they dissapear and
- allow the test to pass.
-
-
-
-
-
- Supports the serialization infrastructure.
-
- Serialization information.
- Streaming context.
-
-
-
- Supports the serialization infrastructure.
-
- Serialization information.
- Streaming context.
-
-
-
- Made internal as it's of no use for
- consumers, but it's important for
- our own tests.
-
-
-
-
- Used by the mock factory to accumulate verification
- failures.
-
-
-
-
- Supports the serialization infrastructure.
-
-
-
-
- A strongly-typed resource class, for looking up localized strings, etc.
-
-
-
-
- Returns the cached ResourceManager instance used by this class.
-
-
-
-
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-
-
-
-
- Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that..
-
-
-
-
- Looks up a localized string similar to Value cannot be an empty string..
-
-
-
-
- Looks up a localized string similar to Can only add interfaces to the mock..
-
-
-
-
- Looks up a localized string similar to Can't set return value for void method {0}..
-
-
-
-
- Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks..
-
-
-
-
- Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type..
-
-
-
-
- Looks up a localized string similar to Could not locate event for attach or detach method {0}..
-
-
-
-
- Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead..
-
-
-
-
- Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. .
-
-
-
-
- Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces.
- Please cast the argument to one of the supported types: {1}.
- Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed..
-
-
-
-
- Looks up a localized string similar to The equals ("==" or "=" in VB) and the conditional 'and' ("&&" or "AndAlso" in VB) operators are the only ones supported in the query specification expression. Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to LINQ method '{0}' not supported..
-
-
-
-
- Looks up a localized string similar to Expression contains a call to a method which is not virtual (overridable in VB) or abstract. Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to Member {0}.{1} does not exist..
-
-
-
-
- Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead:
- mock.Setup(x => x.{1}());
- .
-
-
-
-
- Looks up a localized string similar to {0} invocation failed with mock behavior {1}.
- {2}.
-
-
-
-
- Looks up a localized string similar to Expected only {0} calls to {1}..
-
-
-
-
- Looks up a localized string similar to Expected only one call to {0}..
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at least {2} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at least once, but was never performed: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at most {3} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at most once, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock exactly {2} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock should never have been performed, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock once, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to All invocations on the mock must have a corresponding setup..
-
-
-
-
- Looks up a localized string similar to Object instance was not created by Moq..
-
-
-
-
- Looks up a localized string similar to Out expression must evaluate to a constant value..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not have a getter..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not exist..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} is write-only..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} is read-only..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not have a setter..
-
-
-
-
- Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object..
-
-
-
-
- Looks up a localized string similar to Ref expression must evaluate to a constant value..
-
-
-
-
- Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it..
-
-
-
-
- Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>..
-
-
-
-
- Looks up a localized string similar to Invocation {0} should not have been made..
-
-
-
-
- Looks up a localized string similar to Expression is not a method invocation: {0}.
-
-
-
-
- Looks up a localized string similar to Expression is not a property access: {0}.
-
-
-
-
- Looks up a localized string similar to Expression is not a property setter invocation..
-
-
-
-
- Looks up a localized string similar to Expression references a method that does not belong to the mocked object: {0}.
-
-
-
-
- Looks up a localized string similar to Invalid setup on a non-virtual (overridable in VB) member: {0}.
-
-
-
-
- Looks up a localized string similar to Type {0} does not implement required interface {1}.
-
-
-
-
- Looks up a localized string similar to Type {0} does not from required type {1}.
-
-
-
-
- Looks up a localized string similar to To specify a setup for public property {0}.{1}, use the typed overloads, such as:
- mock.Setup(x => x.{1}).Returns(value);
- mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one
- mock.SetupSet(x => x.{1}).Callback(callbackDelegate);
- .
-
-
-
-
- Looks up a localized string similar to Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}..
-
-
-
-
- Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}..
-
-
-
-
- Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters..
-
-
-
-
- Looks up a localized string similar to Member {0} is not supported for protected mocking..
-
-
-
-
- Looks up a localized string similar to Setter expression can only use static custom matchers..
-
-
-
-
- Looks up a localized string similar to The following setups were not matched:
- {0}.
-
-
-
-
- Looks up a localized string similar to Invalid verify on a non-virtual (overridable in VB) member: {0}.
-
-
-
-
- Allows setups to be specified for protected members by using their
- name as a string, rather than strong-typing them which is not possible
- due to their visibility.
-
-
-
-
- Specifies a setup for a void method invocation with the given
- , optionally specifying arguments for the method call.
-
- The name of the void method to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
-
-
-
- Specifies a setup for an invocation on a property or a non void method with the given
- , optionally specifying arguments for the method call.
-
- The name of the method or property to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
- The return type of the method or property.
-
-
-
- Specifies a setup for an invocation on a property getter with the given
- .
-
- The name of the property.
- The type of the property.
-
-
-
- Specifies a setup for an invocation on a property setter with the given
- .
-
- The name of the property.
- The property value. If argument matchers are used,
- remember to use rather than .
- The type of the property.
-
-
-
- Specifies a verify for a void method with the given ,
- optionally specifying arguments for the method call. Use in conjuntion with the default
- .
-
- The invocation was not call the times specified by
- .
- The name of the void method to be verified.
- The number of times a method is allowed to be called.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
-
-
-
- Specifies a verify for an invocation on a property or a non void method with the given
- , optionally specifying arguments for the method call.
-
- The invocation was not call the times specified by
- .
- The name of the method or property to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
- The number of times a method is allowed to be called.
- The type of return value from the expression.
-
-
-
- Specifies a verify for an invocation on a property getter with the given
- .
- The invocation was not call the times specified by
- .
-
- The name of the property.
- The number of times a method is allowed to be called.
- The type of the property.
-
-
-
- Specifies a setup for an invocation on a property setter with the given
- .
-
- The invocation was not call the times specified by
- .
- The name of the property.
- The number of times a method is allowed to be called.
- The property value.
- The type of the property. If argument matchers are used,
- remember to use rather than .
-
-
-
- Allows the specification of a matching condition for an
- argument in a protected member setup, rather than a specific
- argument value. "ItExpr" refers to the argument being matched.
-
-
- Use this variant of argument matching instead of
- for protected setups.
- This class allows the setup to match a method invocation
- with an arbitrary value, with a value in a specified range, or
- even one that matches a given predicate, or null.
-
-
-
-
- Matches a null value of the given type.
-
-
- Required for protected mocks as the null value cannot be used
- directly as it prevents proper method overload selection.
-
-
-
- // Throws an exception for a call to Remove with a null string value.
- mock.Protected()
- .Setup("Remove", ItExpr.IsNull<string>())
- .Throws(new InvalidOperationException());
-
-
- Type of the value.
-
-
-
- Matches any value of the given type.
-
-
- Typically used when the actual argument value for a method
- call is not relevant.
-
-
-
- // Throws an exception for a call to Remove with any string value.
- mock.Protected()
- .Setup("Remove", ItExpr.IsAny<string>())
- .Throws(new InvalidOperationException());
-
-
- Type of the value.
-
-
-
- Matches any value that satisfies the given predicate.
-
- Type of the argument to check.
- The predicate used to match the method argument.
-
- Allows the specification of a predicate to perform matching
- of method call arguments.
-
-
- This example shows how to return the value 1 whenever the argument to the
- Do method is an even number.
-
- mock.Protected()
- .Setup("Do", ItExpr.Is<int>(i => i % 2 == 0))
- .Returns(1);
-
- This example shows how to throw an exception if the argument to the
- method is a negative number:
-
- mock.Protected()
- .Setup("GetUser", ItExpr.Is<int>(i => i < 0))
- .Throws(new ArgumentException());
-
-
-
-
-
- Matches any value that is in the range specified.
-
- Type of the argument to check.
- The lower bound of the range.
- The upper bound of the range.
- The kind of range. See .
-
- The following example shows how to expect a method call
- with an integer argument within the 0..100 range.
-
- mock.Protected()
- .Setup("HasInventory",
- ItExpr.IsAny<string>(),
- ItExpr.IsInRange(0, 100, Range.Inclusive))
- .Returns(false);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
-
- The pattern to use to match the string argument value.
-
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression:
-
- mock.Protected()
- .Setup("Check", ItExpr.IsRegex("[a-z]+"))
- .Returns(1);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
-
- The pattern to use to match the string argument value.
- The options used to interpret the pattern.
-
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression, in a case insensitive way:
-
- mock.Protected()
- .Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase))
- .Returns(1);
-
-
-
-
-
- Enables the Protected() method on ,
- allowing setups to be set for protected members by using their
- name as a string, rather than strong-typing them which is not possible
- due to their visibility.
-
-
-
-
- Enable protected setups for the mock.
-
- Mocked object type. Typically omitted as it can be inferred from the mock instance.
- The mock to set the protected setups on.
-
-
-
-
-
-
-
-
-
-
-
- Kind of range to use in a filter specified through
- .
-
-
-
-
- The range includes the to and
- from values.
-
-
-
-
- The range does not include the to and
- from values.
-
-
-
-
- Determines the way default values are generated
- calculated for loose mocks.
-
-
-
-
- Default behavior, which generates empty values for
- value types (i.e. default(int)), empty array and
- enumerables, and nulls for all other reference types.
-
-
-
-
- Whenever the default value generated by
- is null, replaces this value with a mock (if the type
- can be mocked).
-
-
- For sealed classes, a null value will be generated.
-
-
-
-
- A default implementation of IQueryable for use with QueryProvider
-
-
-
-
- The is a
- static method that returns an IQueryable of Mocks of T which is used to
- apply the linq specification to.
-
-
-
-
- Allows creation custom value matchers that can be used on setups and verification,
- completely replacing the built-in class with your own argument
- matching rules.
-
- See also .
-
-
-
-
- Provided for the sole purpose of rendering the delegate passed to the
- matcher constructor if no friendly render lambda is provided.
-
-
-
-
- Initializes the match with the condition that
- will be checked in order to match invocation
- values.
- The condition to match against actual values.
-
-
-
-
-
-
-
-
- This method is used to set an expression as the last matcher invoked,
- which is used in the SetupSet to allow matchers in the prop = value
- delegate expression. This delegate is executed in "fluent" mode in
- order to capture the value being set, and construct the corresponding
- methodcall.
- This is also used in the MatcherFactory for each argument expression.
- This method ensures that when we execute the delegate, we
- also track the matcher that was invoked, so that when we create the
- methodcall we build the expression using it, rather than the null/default
- value returned from the actual invocation.
-
-
-
-
- Allows creation custom value matchers that can be used on setups and verification,
- completely replacing the built-in class with your own argument
- matching rules.
- Type of the value to match.
- The argument matching is used to determine whether a concrete
- invocation in the mock matches a given setup. This
- matching mechanism is fully extensible.
-
- Creating a custom matcher is straightforward. You just need to create a method
- that returns a value from a call to with
- your matching condition and optional friendly render expression:
-
- [Matcher]
- public Order IsBigOrder()
- {
- return Match<Order>.Create(
- o => o.GrandTotal >= 5000,
- /* a friendly expression to render on failures */
- () => IsBigOrder());
- }
-
- This method can be used in any mock setup invocation:
-
- mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>();
-
- At runtime, Moq knows that the return value was a matcher (note that the method MUST be
- annotated with the [Matcher] attribute in order to determine this) and
- evaluates your predicate with the actual value passed into your predicate.
-
- Another example might be a case where you want to match a lists of orders
- that contains a particular one. You might create matcher like the following:
-
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order));
- }
- }
-
- Now we can invoke this static method instead of an argument in an
- invocation:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
-
-
-
-
- Tracks the current mock and interception context.
-
-
-
-
- Having an active fluent mock context means that the invocation
- is being performed in "trial" mode, just to gather the
- target method and arguments that need to be matched later
- when the actual invocation is made.
-
-
-
-
- A that returns an empty default value
- for non-mockeable types, and mocks for all other types (interfaces and
- non-sealed classes) that can be mocked.
-
-
-
-
- Allows querying the universe of mocks for those that behave
- according to the LINQ query specification.
-
-
- This entry-point into Linq to Mocks is the only one in the root Moq
- namespace to ease discovery. But to get all the mocking extension
- methods on Object, a using of Moq.Linq must be done, so that the
- polluting of the intellisense for all objects is an explicit opt-in.
-
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The type of the mocked object to query.
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The predicate with the setup expressions.
- The type of the mocked object to query.
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the setup expressions.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates the mock query with the underlying queriable implementation.
-
-
-
-
- Wraps the enumerator inside a queryable.
-
-
-
-
- Method that is turned into the actual call from .Query{T}, to
- transform the queryable query into a normal enumerable query.
- This method is never used directly by consumers.
-
-
-
-
- Extension method used to support Linq-like setup properties that are not virtual but do have
- a getter and a setter, thereby allowing the use of Linq to Mocks to quickly initialize Dtos too :)
-
-
-
-
- Helper extensions that are used by the query translator.
-
-
-
-
- Retrieves a fluent mock from the given setup expression.
-
-
-
-
- Defines the number of invocations allowed by a mocked method.
-
-
-
-
- Specifies that a mocked method should be invoked times as minimum.
- The minimun number of times.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked one time as minimum.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked time as maximun.
- The maximun number of times.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked one time as maximun.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked between and
- times.
- The minimun number of times.The maximun number of times.
- The kind of range. See .
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked exactly times.
- The times that a method or property can be called.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should not be invoked.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked exactly one time.
- An object defining the allowed number of invocations.
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- true if the specified is equal to this instance; otherwise, false.
-
-
-
-
- Returns a hash code for this instance.
-
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
-
-
-
-
- Determines whether two specified objects have the same value.
-
- The first .
-
- The second .
-
- true if the value of left is the same as the value of right; otherwise, false.
-
-
-
-
- Determines whether two specified objects have different values.
-
- The first .
-
- The second .
-
- true if the value of left is different from the value of right; otherwise, false.
-
-
-
-
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.dll b/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.dll
deleted file mode 100644
index 3a3e653..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.dll and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.pdb b/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.pdb
deleted file mode 100644
index 03cca56..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.pdb and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.xml b/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.xml
deleted file mode 100644
index e0743a6..0000000
--- a/RESW File Code Generator/packages/Moq.4.0.10827/lib/NET40/Moq.xml
+++ /dev/null
@@ -1,5120 +0,0 @@
-
-
-
- Moq
-
-
-
-
- Implements the fluent API.
-
-
-
-
- The expectation will be considered only in the former condition.
-
-
-
-
-
-
- The expectation will be considered only in the former condition.
-
-
-
-
-
-
-
- Setups the get.
-
- The type of the property.
- The expression.
-
-
-
-
- Setups the set.
-
- The type of the property.
- The setter expression.
-
-
-
-
- Setups the set.
-
- The setter expression.
-
-
-
-
- Defines the Callback verb and overloads.
-
-
-
-
- Helper interface used to hide the base
- members from the fluent API to make it much cleaner
- in Visual Studio intellisense.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Specifies a callback to invoke when the method is called.
-
- The callback method to invoke.
-
- The following example specifies a callback to set a boolean
- value that can be used later:
-
- var called = false;
- mock.Setup(x => x.Execute())
- .Callback(() => called = true);
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The argument type of the invoked method.
- The callback method to invoke.
-
- Invokes the given callback with the concrete invocation argument value.
-
- Notice how the specific string argument is retrieved by simply declaring
- it as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Callback((string command) => Console.WriteLine(command));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3) => Console.WriteLine(arg1 + arg2 + arg3));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16));
-
-
-
-
-
- Defines the Callback verb and overloads for callbacks on
- setups that return a value.
-
- Mocked type.
- Type of the return value of the setup.
-
-
-
- Specifies a callback to invoke when the method is called.
-
- The callback method to invoke.
-
- The following example specifies a callback to set a boolean value that can be used later:
-
- var called = false;
- mock.Setup(x => x.Execute())
- .Callback(() => called = true)
- .Returns(true);
-
- Note that in the case of value-returning methods, after the Callback
- call you can still specify the return value.
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the argument of the invoked method.
- Callback method to invoke.
-
- Invokes the given callback with the concrete invocation argument value.
-
- Notice how the specific string argument is retrieved by simply declaring
- it as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Callback(command => Console.WriteLine(command))
- .Returns(true);
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2) => Console.WriteLine(arg1 + arg2));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3) => Console.WriteLine(arg1 + arg2 + arg3));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- 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) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Defines the Raises verb.
-
-
-
-
- Specifies the event that will be raised
- when the setup is met.
-
- An expression that represents an event attach or detach action.
- The event arguments to pass for the raised event.
-
- The following example shows how to raise an event when
- the setup is met:
-
- var mock = new Mock<IContainer>();
-
- mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>()))
- .Raises(add => add.Added += null, EventArgs.Empty);
-
-
-
-
-
- Specifies the event that will be raised
- when the setup is matched.
-
- An expression that represents an event attach or detach action.
- A function that will build the
- to pass when raising the event.
-
-
-
-
- Specifies the custom event that will be raised
- when the setup is matched.
-
- An expression that represents an event attach or detach action.
- The arguments to pass to the custom delegate (non EventHandler-compatible).
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
- The type of the fifteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
- The type of the fifteenth argument received by the expected invocation.
- The type of the sixteenth argument received by the expected invocation.
-
-
-
-
- Defines the Returns verb.
-
- Mocked type.
- Type of the return value from the expression.
-
-
-
- Specifies the value to return.
-
- The value to return, or .
-
- Return a true value from the method call:
-
- mock.Setup(x => x.Execute("ping"))
- .Returns(true);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method.
-
- The function that will calculate the return value.
-
- Return a calculated value when the method is called:
-
- mock.Setup(x => x.Execute("ping"))
- .Returns(() => returnValues[0]);
-
- The lambda expression to retrieve the return value is lazy-executed,
- meaning that its value may change depending on the moment the method
- is executed and the value the returnValues array has at
- that moment.
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the argument of the invoked method.
- The function that will calculate the return value.
-
- Return a calculated value which is evaluated lazily at the time of the invocation.
-
- The lookup list can change between invocations and the setup
- will return different values accordingly. Also, notice how the specific
- string argument is retrieved by simply declaring it as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Returns((string command) => returnValues[command]);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2) => arg1 + arg2);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3) => arg1 + arg2 + arg3);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4) => arg1 + arg2 + arg3 + arg4);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5) => arg1 + arg2 + arg3 + arg4 + arg5);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16);
-
-
-
-
-
- Language for ReturnSequence
-
-
-
-
- Returns value
-
-
-
-
- Throws an exception
-
-
-
-
- Throws an exception
-
-
-
-
- The first method call or member access will be the
- last segment of the expression (depth-first traversal),
- which is the one we have to Setup rather than FluentMock.
- And the last one is the one we have to Mock.Get rather
- than FluentMock.
-
-
-
-
- Base class for mocks and static helper class with methods that
- apply to mocked objects, such as to
- retrieve a from an object instance.
-
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the specification of how the mocked object should behave.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Retrieves the mock object for the given object instance.
-
- Type of the mock to retrieve. Can be omitted as it's inferred
- from the object instance passed in as the instance.
- The instance of the mocked object.The mock associated with the mocked object.
- The received instance
- was not created by Moq.
-
- The following example shows how to add a new setup to an object
- instance which is not the original but rather
- the object associated with it:
-
- // Typed instance, not the mock, is retrieved from some test API.
- HttpContextBase context = GetMockContext();
-
- // context.Request is the typed object from the "real" API
- // so in order to add a setup to it, we need to get
- // the mock that "owns" it
- Mock<HttpRequestBase> request = Mock.Get(context.Request);
- mock.Setup(req => req.AppRelativeCurrentExecutionFilePath)
- .Returns(tempUrl);
-
-
-
-
-
- Returns the mocked object value.
-
-
-
-
- Verifies that all verifiable expectations have been met.
-
- This example sets up an expectation and marks it as verifiable. After
- the mock is used, a Verify() call is issued on the mock
- to ensure the method in the setup was invoked:
-
- var mock = new Mock<IWarehouse>();
- this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true);
- ...
- // other test code
- ...
- // Will throw if the test code has didn't call HasInventory.
- this.Verify();
-
- Not all verifiable expectations were met.
-
-
-
- Verifies all expectations regardless of whether they have
- been flagged as verifiable.
-
- This example sets up an expectation without marking it as verifiable. After
- the mock is used, a call is issued on the mock
- to ensure that all expectations are met:
-
- var mock = new Mock<IWarehouse>();
- this.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true);
- ...
- // other test code
- ...
- // Will throw if the test code has didn't call HasInventory, even
- // that expectation was not marked as verifiable.
- this.VerifyAll();
-
- At least one expectation was not met.
-
-
-
- Gets the interceptor target for the given expression and root mock,
- building the intermediate hierarchy of mock objects if necessary.
-
-
-
-
- Raises the associated event with the given
- event argument data.
-
-
-
-
- Raises the associated event with the given
- event argument data.
-
-
-
-
- Adds an interface implementation to the mock,
- allowing setups to be specified for it.
-
- This method can only be called before the first use
- of the mock property, at which
- point the runtime type has already been generated
- and no more interfaces can be added to it.
-
- Also, must be an
- interface and not a class, which must be specified
- when creating the mock instead.
-
-
- The mock type
- has already been generated by accessing the property.
-
- The specified
- is not an interface.
-
- The following example creates a mock for the main interface
- and later adds to it to verify
- it's called by the consumer code:
-
- var mock = new Mock<IProcessor>();
- mock.Setup(x => x.Execute("ping"));
-
- // add IDisposable interface
- var disposable = mock.As<IDisposable>();
- disposable.Setup(d => d.Dispose()).Verifiable();
-
- Type of interface to cast the mock to.
-
-
-
-
-
-
- Behavior of the mock, according to the value set in the constructor.
-
-
-
-
- Whether the base member virtual implementation will be called
- for mocked classes if no setup is matched. Defaults to .
-
-
-
-
- Specifies the behavior to use when returning default values for
- unexpected invocations on loose mocks.
-
-
-
-
- Gets the mocked object instance.
-
-
-
-
- Retrieves the type of the mocked object, its generic type argument.
- This is used in the auto-mocking of hierarchy access.
-
-
-
-
- Specifies the class that will determine the default
- value to return when invocations are made that
- have no setups and need to return a default
- value (for loose mocks).
-
-
-
-
- Exposes the list of extra interfaces implemented by the mock.
-
-
-
-
- Utility repository class to use to construct multiple
- mocks when consistent verification is
- desired for all of them.
-
-
- If multiple mocks will be created during a test, passing
- the desired (if different than the
- or the one
- passed to the repository constructor) and later verifying each
- mock can become repetitive and tedious.
-
- This repository class helps in that scenario by providing a
- simplified creation of multiple mocks with a default
- (unless overriden by calling
- ) and posterior verification.
-
-
-
- The following is a straightforward example on how to
- create and automatically verify strict mocks using a :
-
- var repository = new MockRepository(MockBehavior.Strict);
-
- var foo = repository.Create<IFoo>();
- var bar = repository.Create<IBar>();
-
- // no need to call Verifiable() on the setup
- // as we'll be validating all of them anyway.
- foo.Setup(f => f.Do());
- bar.Setup(b => b.Redo());
-
- // exercise the mocks here
-
- repository.VerifyAll();
- // At this point all setups are already checked
- // and an optional MockException might be thrown.
- // Note also that because the mocks are strict, any invocation
- // that doesn't have a matching setup will also throw a MockException.
-
- The following examples shows how to setup the repository
- to create loose mocks and later verify only verifiable setups:
-
- var repository = new MockRepository(MockBehavior.Loose);
-
- var foo = repository.Create<IFoo>();
- var bar = repository.Create<IBar>();
-
- // this setup will be verified when we verify the repository
- foo.Setup(f => f.Do()).Verifiable();
-
- // this setup will NOT be verified
- foo.Setup(f => f.Calculate());
-
- // this setup will be verified when we verify the repository
- bar.Setup(b => b.Redo()).Verifiable();
-
- // exercise the mocks here
- // note that because the mocks are Loose, members
- // called in the interfaces for which no matching
- // setups exist will NOT throw exceptions,
- // and will rather return default values.
-
- repository.Verify();
- // At this point verifiable setups are already checked
- // and an optional MockException might be thrown.
-
- The following examples shows how to setup the repository with a
- default strict behavior, overriding that default for a
- specific mock:
-
- var repository = new MockRepository(MockBehavior.Strict);
-
- // this particular one we want loose
- var foo = repository.Create<IFoo>(MockBehavior.Loose);
- var bar = repository.Create<IBar>();
-
- // specify setups
-
- // exercise the mocks here
-
- repository.Verify();
-
-
-
-
-
-
- Utility factory class to use to construct multiple
- mocks when consistent verification is
- desired for all of them.
-
-
- If multiple mocks will be created during a test, passing
- the desired (if different than the
- or the one
- passed to the factory constructor) and later verifying each
- mock can become repetitive and tedious.
-
- This factory class helps in that scenario by providing a
- simplified creation of multiple mocks with a default
- (unless overriden by calling
- ) and posterior verification.
-
-
-
- The following is a straightforward example on how to
- create and automatically verify strict mocks using a :
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>();
- var bar = factory.Create<IBar>();
-
- // no need to call Verifiable() on the setup
- // as we'll be validating all of them anyway.
- foo.Setup(f => f.Do());
- bar.Setup(b => b.Redo());
-
- // exercise the mocks here
-
- factory.VerifyAll();
- // At this point all setups are already checked
- // and an optional MockException might be thrown.
- // Note also that because the mocks are strict, any invocation
- // that doesn't have a matching setup will also throw a MockException.
-
- The following examples shows how to setup the factory
- to create loose mocks and later verify only verifiable setups:
-
- var factory = new MockFactory(MockBehavior.Loose);
-
- var foo = factory.Create<IFoo>();
- var bar = factory.Create<IBar>();
-
- // this setup will be verified when we verify the factory
- foo.Setup(f => f.Do()).Verifiable();
-
- // this setup will NOT be verified
- foo.Setup(f => f.Calculate());
-
- // this setup will be verified when we verify the factory
- bar.Setup(b => b.Redo()).Verifiable();
-
- // exercise the mocks here
- // note that because the mocks are Loose, members
- // called in the interfaces for which no matching
- // setups exist will NOT throw exceptions,
- // and will rather return default values.
-
- factory.Verify();
- // At this point verifiable setups are already checked
- // and an optional MockException might be thrown.
-
- The following examples shows how to setup the factory with a
- default strict behavior, overriding that default for a
- specific mock:
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- // this particular one we want loose
- var foo = factory.Create<IFoo>(MockBehavior.Loose);
- var bar = factory.Create<IBar>();
-
- // specify setups
-
- // exercise the mocks here
-
- factory.Verify();
-
-
-
-
-
-
- Initializes the factory with the given
- for newly created mocks from the factory.
-
- The behavior to use for mocks created
- using the factory method if not overriden
- by using the overload.
-
-
-
- Creates a new mock with the default
- specified at factory construction time.
-
- Type to mock.
- A new .
-
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>();
- // use mock on tests
-
- factory.VerifyAll();
-
-
-
-
-
- Creates a new mock with the default
- specified at factory construction time and with the
- the given constructor arguments for the class.
-
-
- The mock will try to find the best match constructor given the
- constructor arguments, and invoke that to initialize the instance.
- This applies only to classes, not interfaces.
-
- Type to mock.
- Constructor arguments for mocked classes.
- A new .
-
-
- var factory = new MockFactory(MockBehavior.Default);
-
- var mock = factory.Create<MyBase>("Foo", 25, true);
- // use mock on tests
-
- factory.Verify();
-
-
-
-
-
- Creates a new mock with the given .
-
- Type to mock.
- Behavior to use for the mock, which overrides
- the default behavior specified at factory construction time.
- A new .
-
- The following example shows how to create a mock with a different
- behavior to that specified as the default for the factory:
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>(MockBehavior.Loose);
-
-
-
-
-
- Creates a new mock with the given
- and with the the given constructor arguments for the class.
-
-
- The mock will try to find the best match constructor given the
- constructor arguments, and invoke that to initialize the instance.
- This applies only to classes, not interfaces.
-
- Type to mock.
- Behavior to use for the mock, which overrides
- the default behavior specified at factory construction time.
- Constructor arguments for mocked classes.
- A new .
-
- The following example shows how to create a mock with a different
- behavior to that specified as the default for the factory, passing
- constructor arguments:
-
- var factory = new MockFactory(MockBehavior.Default);
-
- var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true);
-
-
-
-
-
- Implements creation of a new mock within the factory.
-
- Type to mock.
- The behavior for the new mock.
- Optional arguments for the construction of the mock.
-
-
-
- Verifies all verifiable expectations on all mocks created
- by this factory.
-
-
- One or more mocks had expectations that were not satisfied.
-
-
-
- Verifies all verifiable expectations on all mocks created
- by this factory.
-
-
- One or more mocks had expectations that were not satisfied.
-
-
-
- Invokes for each mock
- in , and accumulates the resulting
- that might be
- thrown from the action.
-
- The action to execute against
- each mock.
-
-
-
- Whether the base member virtual implementation will be called
- for mocked classes if no setup is matched. Defaults to .
-
-
-
-
- Specifies the behavior to use when returning default values for
- unexpected invocations on loose mocks.
-
-
-
-
- Gets the mocks that have been created by this factory and
- that will get verified together.
-
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The type of the mocked object to query.
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The predicate with the setup expressions.
- The type of the mocked object to query.
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the setup expressions.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates the mock query with the underlying queriable implementation.
-
-
-
-
- Wraps the enumerator inside a queryable.
-
-
-
-
- Method that is turned into the actual call from .Query{T}, to
- transform the queryable query into a normal enumerable query.
- This method is never used directly by consumers.
-
-
-
-
- Initializes the repository with the given
- for newly created mocks from the repository.
-
- The behavior to use for mocks created
- using the repository method if not overriden
- by using the overload.
-
-
-
- A that returns an empty default value
- for invocations that do not have setups or return values, with loose mocks.
- This is the default behavior for a mock.
-
-
-
-
- Interface to be implemented by classes that determine the
- default value of non-expected invocations.
-
-
-
-
- Defines the default value to return in all the methods returning .
- The type of the return value.The value to set as default.
-
-
-
- Provides a value for the given member and arguments.
-
- The member to provide a default value for.
-
-
-
-
- The intention of is to create a more readable
- string representation for the failure message.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Throws verb.
-
-
-
-
- Specifies the exception to throw when the method is invoked.
-
- Exception instance to throw.
-
- This example shows how to throw an exception when the method is
- invoked with an empty string argument:
-
- mock.Setup(x => x.Execute(""))
- .Throws(new ArgumentException());
-
-
-
-
-
- Specifies the type of exception to throw when the method is invoked.
-
- Type of exception to instantiate and throw when the setup is matched.
-
- This example shows how to throw an exception when the method is
- invoked with an empty string argument:
-
- mock.Setup(x => x.Execute(""))
- .Throws<ArgumentException>();
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines occurrence members to constraint setups.
-
-
-
-
- The expected invocation can happen at most once.
-
-
-
- var mock = new Mock<ICommand>();
- mock.Setup(foo => foo.Execute("ping"))
- .AtMostOnce();
-
-
-
-
-
- The expected invocation can happen at most specified number of times.
-
- The number of times to accept calls.
-
-
- var mock = new Mock<ICommand>();
- mock.Setup(foo => foo.Execute("ping"))
- .AtMost( 5 );
-
-
-
-
-
- Defines the Verifiable verb.
-
-
-
-
- Marks the expectation as verifiable, meaning that a call
- to will check if this particular
- expectation was met.
-
-
- The following example marks the expectation as verifiable:
-
- mock.Expect(x => x.Execute("ping"))
- .Returns(true)
- .Verifiable();
-
-
-
-
-
- Marks the expectation as verifiable, meaning that a call
- to will check if this particular
- expectation was met, and specifies a message for failures.
-
-
- The following example marks the expectation as verifiable:
-
- mock.Expect(x => x.Execute("ping"))
- .Returns(true)
- .Verifiable("Ping should be executed always!");
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- We need this non-generics base class so that
- we can use from
- generic code.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb for property getter setups.
-
-
- Mocked type.
- Type of the property.
-
-
-
- Specifies a callback to invoke when the property is retrieved.
-
- Callback method to invoke.
-
- Invokes the given callback with the property value being set.
-
- mock.SetupGet(x => x.Suspended)
- .Callback(() => called = true)
- .Returns(true);
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Returns verb for property get setups.
-
- Mocked type.
- Type of the property.
-
-
-
- Specifies the value to return.
-
- The value to return, or .
-
- Return a true value from the property getter call:
-
- mock.SetupGet(x => x.Suspended)
- .Returns(true);
-
-
-
-
-
- Specifies a function that will calculate the value to return for the property.
-
- The function that will calculate the return value.
-
- Return a calculated value when the property is retrieved:
-
- mock.SetupGet(x => x.Suspended)
- .Returns(() => returnValues[0]);
-
- The lambda expression to retrieve the return value is lazy-executed,
- meaning that its value may change depending on the moment the property
- is retrieved and the value the returnValues array has at
- that moment.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Helper class to setup a full trace between many mocks
-
-
-
-
- Initialize a trace setup
-
-
-
-
- Allow sequence to be repeated
-
-
-
-
- define nice api
-
-
-
-
- Perform an expectation in the trace.
-
-
-
-
- Marks a method as a matcher, which allows complete replacement
- of the built-in class with your own argument
- matching rules.
-
-
- This feature has been deprecated in favor of the new
- and simpler .
-
-
- The argument matching is used to determine whether a concrete
- invocation in the mock matches a given setup. This
- matching mechanism is fully extensible.
-
-
- There are two parts of a matcher: the compiler matcher
- and the runtime matcher.
-
- -
- Compiler matcher
- Used to satisfy the compiler requirements for the
- argument. Needs to be a method optionally receiving any arguments
- you might need for the matching, but with a return type that
- matches that of the argument.
-
- Let's say I want to match a lists of orders that contains
- a particular one. I might create a compiler matcher like the following:
-
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return null;
- }
- }
-
- Now we can invoke this static method instead of an argument in an
- invocation:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
- Note that the return value from the compiler matcher is irrelevant.
- This method will never be called, and is just used to satisfy the
- compiler and to signal Moq that this is not a method that we want
- to be invoked at runtime.
-
-
- -
- Runtime matcher
-
- The runtime matcher is the one that will actually perform evaluation
- when the test is run, and is defined by convention to have the
- same signature as the compiler matcher, but where the return
- value is the first argument to the call, which contains the
- object received by the actual invocation at runtime:
-
- public static bool Contains(IEnumerable<Order> orders, Order order)
- {
- return orders.Contains(order);
- }
-
- At runtime, the mocked method will be invoked with a specific
- list of orders. This value will be passed to this runtime
- matcher as the first argument, while the second argument is the
- one specified in the setup (x.Save(Orders.Contains(order))).
-
- The boolean returned determines whether the given argument has been
- matched. If all arguments to the expected method are matched, then
- the setup matches and is evaluated.
-
-
-
-
-
- Using this extensible infrastructure, you can easily replace the entire
- set of matchers with your own. You can also avoid the
- typical (and annoying) lengthy expressions that result when you have
- multiple arguments that use generics.
-
-
- The following is the complete example explained above:
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return null;
- }
-
- public static bool Contains(IEnumerable<Order> orders, Order order)
- {
- return orders.Contains(order);
- }
- }
-
- And the concrete test using this matcher:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
- // use mock, invoke Save, and have the matcher filter.
-
-
-
-
-
- Provides a mock implementation of .
-
- Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked.
-
- The behavior of the mock with regards to the setups and the actual calls is determined
- by the optional that can be passed to the
- constructor.
-
- Type to mock, which can be an interface or a class.
- The following example shows establishing setups with specific values
- for method invocations:
-
- // Arrange
- var order = new Order(TALISKER, 50);
- var mock = new Mock<IWarehouse>();
-
- mock.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true);
-
- // Act
- order.Fill(mock.Object);
-
- // Assert
- Assert.True(order.IsFilled);
-
- The following example shows how to use the class
- to specify conditions for arguments instead of specific values:
-
- // Arrange
- var order = new Order(TALISKER, 50);
- var mock = new Mock<IWarehouse>();
-
- // shows how to expect a value within a range
- mock.Setup(x => x.HasInventory(
- It.IsAny<string>(),
- It.IsInRange(0, 100, Range.Inclusive)))
- .Returns(false);
-
- // shows how to throw for unexpected calls.
- mock.Setup(x => x.Remove(
- It.IsAny<string>(),
- It.IsAny<int>()))
- .Throws(new InvalidOperationException());
-
- // Act
- order.Fill(mock.Object);
-
- // Assert
- Assert.False(order.IsFilled);
-
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Ctor invoked by AsTInterface exclusively.
-
-
-
-
- Initializes an instance of the mock with default behavior.
-
- var mock = new Mock<IFormatProvider>();
-
-
-
-
- Initializes an instance of the mock with default behavior and with
- the given constructor arguments for the class. (Only valid when is a class)
-
- The mock will try to find the best match constructor given the constructor arguments, and invoke that
- to initialize the instance. This applies only for classes, not interfaces.
-
- var mock = new Mock<MyProvider>(someArgument, 25);
- Optional constructor arguments if the mocked type is a class.
-
-
-
- Initializes an instance of the mock with the specified behavior.
-
- var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed);
- Behavior of the mock.
-
-
-
- Initializes an instance of the mock with a specific behavior with
- the given constructor arguments for the class.
-
- The mock will try to find the best match constructor given the constructor arguments, and invoke that
- to initialize the instance. This applies only to classes, not interfaces.
-
- var mock = new Mock<MyProvider>(someArgument, 25);
- Behavior of the mock.Optional constructor arguments if the mocked type is a class.
-
-
-
- Returns the mocked object value.
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a void method.
-
- If more than one setup is specified for the same method or property,
- the latest one wins and is the one that will be executed.
- Lambda expression that specifies the expected method invocation.
-
- var mock = new Mock<IProcessor>();
- mock.Setup(x => x.Execute("ping"));
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a value returning method.
- Type of the return value. Typically omitted as it can be inferred from the expression.
- If more than one setup is specified for the same method or property,
- the latest one wins and is the one that will be executed.
- Lambda expression that specifies the method invocation.
-
- mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property getter.
-
- If more than one setup is set for the same property getter,
- the latest one wins and is the one that will be executed.
- Type of the property. Typically omitted as it can be inferred from the expression.Lambda expression that specifies the property getter.
-
- mock.SetupGet(x => x.Suspended)
- .Returns(true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter.
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
-
- This overloads allows the use of a callback already
- typed for the property type.
-
- Type of the property. Typically omitted as it can be inferred from the expression.The Lambda expression that sets a property to a value.
-
- mock.SetupSet(x => x.Suspended = true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter.
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
- Lambda expression that sets a property to a value.
-
- mock.SetupSet(x => x.Suspended = true);
-
-
-
-
-
- Specifies that the given property should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. (this is also
- known as "stubbing").
-
- Type of the property, inferred from the property
- expression (does not need to be specified).
- Property expression to stub.
- If you have an interface with an int property Value, you might
- stub it using the following straightforward call:
-
- var mock = new Mock<IHaveValue>();
- mock.Stub(v => v.Value);
-
- After the Stub call has been issued, setting and
- retrieving the object value will behave as expected:
-
- IHaveValue v = mock.Object;
-
- v.Value = 5;
- Assert.Equal(5, v.Value);
-
-
-
-
-
- Specifies that the given property should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. This overload
- allows setting the initial value for the property. (this is also
- known as "stubbing").
-
- Type of the property, inferred from the property
- expression (does not need to be specified).
- Property expression to stub.Initial value for the property.
- If you have an interface with an int property Value, you might
- stub it using the following straightforward call:
-
- var mock = new Mock<IHaveValue>();
- mock.SetupProperty(v => v.Value, 5);
-
- After the SetupProperty call has been issued, setting and
- retrieving the object value will behave as expected:
-
- IHaveValue v = mock.Object;
- // Initial value was stored
- Assert.Equal(5, v.Value);
-
- // New value set which changes the initial value
- v.Value = 6;
- Assert.Equal(6, v.Value);
-
-
-
-
-
- Specifies that the all properties on the mock should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. (this is also
- known as "stubbing"). The default value for each property will be the
- one generated as specified by the property for the mock.
-
- If the mock is set to ,
- the mocked default values will also get all properties setup recursively.
-
-
-
-
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IProcessor>();
- // exercise mock
- //...
- // Will throw if the test code didn't call Execute with a "ping" string argument.
- mock.Verify(proc => proc.Execute("ping"));
-
- The invocation was not performed on the mock.Expression to verify.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock,
- specifying a failure error message. Use in conjuntion with the default
- .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IProcessor>();
- // exercise mock
- //...
- // Will throw if the test code didn't call Execute with a "ping" string argument.
- mock.Verify(proc => proc.Execute("ping"));
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock,
- specifying a failure error message. Use in conjuntion with the default
- .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't call HasInventory.
- mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50));
-
- The invocation was not performed on the mock.Expression to verify.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock. Use in conjuntion
- with the default .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock, specifying a failure
- error message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't call HasInventory.
- mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50), "When filling orders, inventory has to be checked");
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock, specifying a failure
- error message.
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.Type of return value from the expression.
-
-
-
- Verifies that a property was read on the mock.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was retrieved from it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't retrieve the IsClosed property.
- mock.VerifyGet(warehouse => warehouse.IsClosed);
-
- The invocation was not performed on the mock.Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock, specifying a failure
- error message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was retrieved from it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't retrieve the IsClosed property.
- mock.VerifyGet(warehouse => warehouse.IsClosed);
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock, specifying a failure
- error message.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was set on the mock.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was set on it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed = true);
-
- The invocation was not performed on the mock.Expression to verify.
-
-
-
- Verifies that a property was set on the mock.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.
-
-
-
- Verifies that a property was set on the mock, specifying
- a failure message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was set on it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action");
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
-
-
-
- Verifies that a property was set on the mock, specifying
- a failure message.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails.
-
-
-
- Raises the event referenced in using
- the given argument.
-
- The argument is
- invalid for the target event invocation, or the is
- not an event attach or detach expression.
-
- The following example shows how to raise a event:
-
- var mock = new Mock<IViewModel>();
-
- mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name"));
-
-
- This example shows how to invoke an event with a custom event arguments
- class in a view that will cause its corresponding presenter to
- react by changing its state:
-
- var mockView = new Mock<IOrdersView>();
- var presenter = new OrdersPresenter(mockView.Object);
-
- // Check that the presenter has no selection by default
- Assert.Null(presenter.SelectedOrder);
-
- // Raise the event with a specific arguments data
- mockView.Raise(v => v.SelectionChanged += null, new OrderEventArgs { Order = new Order("moq", 500) });
-
- // Now the presenter reacted to the event, and we have a selected order
- Assert.NotNull(presenter.SelectedOrder);
- Assert.Equal("moq", presenter.SelectedOrder.ProductName);
-
-
-
-
-
- Raises the event referenced in using
- the given argument for a non-EventHandler typed event.
-
- The arguments are
- invalid for the target event invocation, or the is
- not an event attach or detach expression.
-
- The following example shows how to raise a custom event that does not adhere to
- the standard EventHandler:
-
- var mock = new Mock<IViewModel>();
-
- mock.Raise(x => x.MyEvent -= null, "Name", bool, 25);
-
-
-
-
-
- Exposes the mocked object instance.
-
-
-
-
- Provides legacy API members as extensions so that
- existing code continues to compile, but new code
- doesn't see then.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Provides additional methods on mocks.
-
-
- Provided as extension methods as they confuse the compiler
- with the overloads taking Action.
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter, regardless of its value.
-
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
-
- Type of the property. Typically omitted as it can be inferred from the expression.
- Type of the mock.
- The target mock for the setup.
- Lambda expression that specifies the property setter.
-
-
- mock.SetupSet(x => x.Suspended);
-
-
-
- This method is not legacy, but must be on an extension method to avoid
- confusing the compiler with the new Action syntax.
-
-
-
-
- Verifies that a property has been set on the mock, regarless of its value.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- Expression to verify.
- The mock instance.
- Mocked type.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, specifying a failure
- error message.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- Expression to verify.
- Message to show if verification fails.
- The mock instance.
- Mocked type.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, regardless
- of the value but only the specified number of times.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- The invocation was not call the times specified by
- .
- The mock instance.
- Mocked type.
- The number of times a method is allowed to be called.
- Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, regardless
- of the value but only the specified number of times, and specifying a failure
- error message.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- The invocation was not call the times specified by
- .
- The mock instance.
- Mocked type.
- The number of times a method is allowed to be called.
- Message to show if verification fails.
- Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Helper for sequencing return values in the same method.
-
-
-
-
- Return a sequence of values, once per call.
-
-
-
-
- Casts the expression to a lambda expression, removing
- a cast if there's any.
-
-
-
-
- Casts the body of the lambda expression to a .
-
- If the body is not a method call.
-
-
-
- Converts the body of the lambda expression into the referenced by it.
-
-
-
-
- Checks whether the body of the lambda expression is a property access.
-
-
-
-
- Checks whether the expression is a property access.
-
-
-
-
- Checks whether the body of the lambda expression is a property indexer, which is true
- when the expression is an whose
- has
- equal to .
-
-
-
-
- Checks whether the expression is a property indexer, which is true
- when the expression is an whose
- has
- equal to .
-
-
-
-
- Creates an expression that casts the given expression to the
- type.
-
-
-
-
- TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583
- is fixed.
-
-
-
-
- Provides partial evaluation of subtrees, whenever they can be evaluated locally.
-
- Matt Warren: http://blogs.msdn.com/mattwar
- Documented by InSTEDD: http://www.instedd.org
-
-
-
- Performs evaluation and replacement of independent sub-trees
-
- The root of the expression tree.
- A function that decides whether a given expression
- node can be part of the local function.
- A new tree with sub-trees evaluated and replaced.
-
-
-
- Performs evaluation and replacement of independent sub-trees
-
- The root of the expression tree.
- A new tree with sub-trees evaluated and replaced.
-
-
-
- Evaluates and replaces sub-trees when first candidate is reached (top-down)
-
-
-
-
- Performs bottom-up analysis to determine which nodes can possibly
- be part of an evaluated sub-tree.
-
-
-
-
- Ensures the given is not null.
- Throws otherwise.
-
-
-
-
- Ensures the given string is not null or empty.
- Throws in the first case, or
- in the latter.
-
-
-
-
- Checks an argument to ensure it is in the specified range including the edges.
-
- Type of the argument to check, it must be an type.
-
- The expression containing the name of the argument.
- The argument value to check.
- The minimun allowed value for the argument.
- The maximun allowed value for the argument.
-
-
-
- Checks an argument to ensure it is in the specified range excluding the edges.
-
- Type of the argument to check, it must be an type.
-
- The expression containing the name of the argument.
- The argument value to check.
- The minimun allowed value for the argument.
- The maximun allowed value for the argument.
-
-
-
- Implemented by all generated mock object instances.
-
-
-
-
- Implemented by all generated mock object instances.
-
-
-
-
- Reference the Mock that contains this as the mock.Object value.
-
-
-
-
- Reference the Mock that contains this as the mock.Object value.
-
-
-
-
- Implements the actual interception and method invocation for
- all mocks.
-
-
-
-
- Get an eventInfo for a given event name. Search type ancestors depth first if necessary.
-
- Name of the event, with the set_ or get_ prefix already removed
-
-
-
- Given a type return all of its ancestors, both types and interfaces.
-
- The type to find immediate ancestors of
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb for property setter setups.
-
- Type of the property.
-
-
-
- Specifies a callback to invoke when the property is set that receives the
- property value being set.
-
- Callback method to invoke.
-
- Invokes the given callback with the property value being set.
-
- mock.SetupSet(x => x.Suspended)
- .Callback((bool state) => Console.WriteLine(state));
-
-
-
-
-
- Allows the specification of a matching condition for an
- argument in a method invocation, rather than a specific
- argument value. "It" refers to the argument being matched.
-
- This class allows the setup to match a method invocation
- with an arbitrary value, with a value in a specified range, or
- even one that matches a given predicate.
-
-
-
-
- Matches any value of the given type.
-
- Typically used when the actual argument value for a method
- call is not relevant.
-
-
- // Throws an exception for a call to Remove with any string value.
- mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException());
-
- Type of the value.
-
-
-
- Matches any value that satisfies the given predicate.
- Type of the argument to check.The predicate used to match the method argument.
- Allows the specification of a predicate to perform matching
- of method call arguments.
-
- This example shows how to return the value 1 whenever the argument to the
- Do method is an even number.
-
- mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0)))
- .Returns(1);
-
- This example shows how to throw an exception if the argument to the
- method is a negative number:
-
- mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0)))
- .Throws(new ArgumentException());
-
-
-
-
-
- Matches any value that is in the range specified.
- Type of the argument to check.The lower bound of the range.The upper bound of the range.
- The kind of range. See .
-
- The following example shows how to expect a method call
- with an integer argument within the 0..100 range.
-
- mock.Setup(x => x.HasInventory(
- It.IsAny<string>(),
- It.IsInRange(0, 100, Range.Inclusive)))
- .Returns(false);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
- The pattern to use to match the string argument value.
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression:
-
- mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
- The pattern to use to match the string argument value.The options used to interpret the pattern.
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression, in a case insensitive way:
-
- mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1);
-
-
-
-
-
- Matcher to treat static functions as matchers.
-
- mock.Setup(x => x.StringMethod(A.MagicString()));
-
- public static class A
- {
- [Matcher]
- public static string MagicString() { return null; }
- public static bool MagicString(string arg)
- {
- return arg == "magic";
- }
- }
-
- Will succeed if: mock.Object.StringMethod("magic");
- and fail with any other call.
-
-
-
-
- Options to customize the behavior of the mock.
-
-
-
-
- Causes the mock to always throw
- an exception for invocations that don't have a
- corresponding setup.
-
-
-
-
- Will never throw exceptions, returning default
- values when necessary (null for reference types,
- zero for value types or empty enumerables and arrays).
-
-
-
-
- Default mock behavior, which equals .
-
-
-
-
- Exception thrown by mocks when setups are not matched,
- the mock is not properly setup, etc.
-
-
- A distinct exception type is provided so that exceptions
- thrown by the mock can be differentiated in tests that
- expect other exceptions to be thrown (i.e. ArgumentException).
-
- Richer exception hierarchy/types are not provided as
- tests typically should not catch or expect exceptions
- from the mocks. These are typically the result of changes
- in the tested class or its collaborators implementation, and
- result in fixes in the mock setup so that they dissapear and
- allow the test to pass.
-
-
-
-
-
- Supports the serialization infrastructure.
-
- Serialization information.
- Streaming context.
-
-
-
- Supports the serialization infrastructure.
-
- Serialization information.
- Streaming context.
-
-
-
- Made internal as it's of no use for
- consumers, but it's important for
- our own tests.
-
-
-
-
- Used by the mock factory to accumulate verification
- failures.
-
-
-
-
- Supports the serialization infrastructure.
-
-
-
-
- A strongly-typed resource class, for looking up localized strings, etc.
-
-
-
-
- Returns the cached ResourceManager instance used by this class.
-
-
-
-
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-
-
-
-
- Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that..
-
-
-
-
- Looks up a localized string similar to Value cannot be an empty string..
-
-
-
-
- Looks up a localized string similar to Can only add interfaces to the mock..
-
-
-
-
- Looks up a localized string similar to Can't set return value for void method {0}..
-
-
-
-
- Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks..
-
-
-
-
- Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type..
-
-
-
-
- Looks up a localized string similar to Could not locate event for attach or detach method {0}..
-
-
-
-
- Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead..
-
-
-
-
- Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. .
-
-
-
-
- Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces.
- Please cast the argument to one of the supported types: {1}.
- Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed..
-
-
-
-
- Looks up a localized string similar to The equals ("==" or "=" in VB) and the conditional 'and' ("&&" or "AndAlso" in VB) operators are the only ones supported in the query specification expression. Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to LINQ method '{0}' not supported..
-
-
-
-
- Looks up a localized string similar to Expression contains a call to a method which is not virtual (overridable in VB) or abstract. Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to Member {0}.{1} does not exist..
-
-
-
-
- Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead:
- mock.Setup(x => x.{1}());
- .
-
-
-
-
- Looks up a localized string similar to {0} invocation failed with mock behavior {1}.
- {2}.
-
-
-
-
- Looks up a localized string similar to Expected only {0} calls to {1}..
-
-
-
-
- Looks up a localized string similar to Expected only one call to {0}..
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at least {2} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at least once, but was never performed: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at most {3} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at most once, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock exactly {2} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock should never have been performed, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock once, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to All invocations on the mock must have a corresponding setup..
-
-
-
-
- Looks up a localized string similar to Object instance was not created by Moq..
-
-
-
-
- Looks up a localized string similar to Out expression must evaluate to a constant value..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not have a getter..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not exist..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} is write-only..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} is read-only..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not have a setter..
-
-
-
-
- Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object..
-
-
-
-
- Looks up a localized string similar to Ref expression must evaluate to a constant value..
-
-
-
-
- Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it..
-
-
-
-
- Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>..
-
-
-
-
- Looks up a localized string similar to Invocation {0} should not have been made..
-
-
-
-
- Looks up a localized string similar to Expression is not a method invocation: {0}.
-
-
-
-
- Looks up a localized string similar to Expression is not a property access: {0}.
-
-
-
-
- Looks up a localized string similar to Expression is not a property setter invocation..
-
-
-
-
- Looks up a localized string similar to Expression references a method that does not belong to the mocked object: {0}.
-
-
-
-
- Looks up a localized string similar to Invalid setup on a non-virtual (overridable in VB) member: {0}.
-
-
-
-
- Looks up a localized string similar to Type {0} does not implement required interface {1}.
-
-
-
-
- Looks up a localized string similar to Type {0} does not from required type {1}.
-
-
-
-
- Looks up a localized string similar to To specify a setup for public property {0}.{1}, use the typed overloads, such as:
- mock.Setup(x => x.{1}).Returns(value);
- mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one
- mock.SetupSet(x => x.{1}).Callback(callbackDelegate);
- .
-
-
-
-
- Looks up a localized string similar to Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}..
-
-
-
-
- Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}..
-
-
-
-
- Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters..
-
-
-
-
- Looks up a localized string similar to Member {0} is not supported for protected mocking..
-
-
-
-
- Looks up a localized string similar to Setter expression can only use static custom matchers..
-
-
-
-
- Looks up a localized string similar to The following setups were not matched:
- {0}.
-
-
-
-
- Looks up a localized string similar to Invalid verify on a non-virtual (overridable in VB) member: {0}.
-
-
-
-
- Allows setups to be specified for protected members by using their
- name as a string, rather than strong-typing them which is not possible
- due to their visibility.
-
-
-
-
- Specifies a setup for a void method invocation with the given
- , optionally specifying arguments for the method call.
-
- The name of the void method to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
-
-
-
- Specifies a setup for an invocation on a property or a non void method with the given
- , optionally specifying arguments for the method call.
-
- The name of the method or property to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
- The return type of the method or property.
-
-
-
- Specifies a setup for an invocation on a property getter with the given
- .
-
- The name of the property.
- The type of the property.
-
-
-
- Specifies a setup for an invocation on a property setter with the given
- .
-
- The name of the property.
- The property value. If argument matchers are used,
- remember to use rather than .
- The type of the property.
-
-
-
- Specifies a verify for a void method with the given ,
- optionally specifying arguments for the method call. Use in conjuntion with the default
- .
-
- The invocation was not call the times specified by
- .
- The name of the void method to be verified.
- The number of times a method is allowed to be called.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
-
-
-
- Specifies a verify for an invocation on a property or a non void method with the given
- , optionally specifying arguments for the method call.
-
- The invocation was not call the times specified by
- .
- The name of the method or property to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
- The number of times a method is allowed to be called.
- The type of return value from the expression.
-
-
-
- Specifies a verify for an invocation on a property getter with the given
- .
- The invocation was not call the times specified by
- .
-
- The name of the property.
- The number of times a method is allowed to be called.
- The type of the property.
-
-
-
- Specifies a setup for an invocation on a property setter with the given
- .
-
- The invocation was not call the times specified by
- .
- The name of the property.
- The number of times a method is allowed to be called.
- The property value.
- The type of the property. If argument matchers are used,
- remember to use rather than .
-
-
-
- Allows the specification of a matching condition for an
- argument in a protected member setup, rather than a specific
- argument value. "ItExpr" refers to the argument being matched.
-
-
- Use this variant of argument matching instead of
- for protected setups.
- This class allows the setup to match a method invocation
- with an arbitrary value, with a value in a specified range, or
- even one that matches a given predicate, or null.
-
-
-
-
- Matches a null value of the given type.
-
-
- Required for protected mocks as the null value cannot be used
- directly as it prevents proper method overload selection.
-
-
-
- // Throws an exception for a call to Remove with a null string value.
- mock.Protected()
- .Setup("Remove", ItExpr.IsNull<string>())
- .Throws(new InvalidOperationException());
-
-
- Type of the value.
-
-
-
- Matches any value of the given type.
-
-
- Typically used when the actual argument value for a method
- call is not relevant.
-
-
-
- // Throws an exception for a call to Remove with any string value.
- mock.Protected()
- .Setup("Remove", ItExpr.IsAny<string>())
- .Throws(new InvalidOperationException());
-
-
- Type of the value.
-
-
-
- Matches any value that satisfies the given predicate.
-
- Type of the argument to check.
- The predicate used to match the method argument.
-
- Allows the specification of a predicate to perform matching
- of method call arguments.
-
-
- This example shows how to return the value 1 whenever the argument to the
- Do method is an even number.
-
- mock.Protected()
- .Setup("Do", ItExpr.Is<int>(i => i % 2 == 0))
- .Returns(1);
-
- This example shows how to throw an exception if the argument to the
- method is a negative number:
-
- mock.Protected()
- .Setup("GetUser", ItExpr.Is<int>(i => i < 0))
- .Throws(new ArgumentException());
-
-
-
-
-
- Matches any value that is in the range specified.
-
- Type of the argument to check.
- The lower bound of the range.
- The upper bound of the range.
- The kind of range. See .
-
- The following example shows how to expect a method call
- with an integer argument within the 0..100 range.
-
- mock.Protected()
- .Setup("HasInventory",
- ItExpr.IsAny<string>(),
- ItExpr.IsInRange(0, 100, Range.Inclusive))
- .Returns(false);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
-
- The pattern to use to match the string argument value.
-
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression:
-
- mock.Protected()
- .Setup("Check", ItExpr.IsRegex("[a-z]+"))
- .Returns(1);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
-
- The pattern to use to match the string argument value.
- The options used to interpret the pattern.
-
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression, in a case insensitive way:
-
- mock.Protected()
- .Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase))
- .Returns(1);
-
-
-
-
-
- Enables the Protected() method on ,
- allowing setups to be set for protected members by using their
- name as a string, rather than strong-typing them which is not possible
- due to their visibility.
-
-
-
-
- Enable protected setups for the mock.
-
- Mocked object type. Typically omitted as it can be inferred from the mock instance.
- The mock to set the protected setups on.
-
-
-
-
-
-
-
-
-
-
-
- Kind of range to use in a filter specified through
- .
-
-
-
-
- The range includes the to and
- from values.
-
-
-
-
- The range does not include the to and
- from values.
-
-
-
-
- Determines the way default values are generated
- calculated for loose mocks.
-
-
-
-
- Default behavior, which generates empty values for
- value types (i.e. default(int)), empty array and
- enumerables, and nulls for all other reference types.
-
-
-
-
- Whenever the default value generated by
- is null, replaces this value with a mock (if the type
- can be mocked).
-
-
- For sealed classes, a null value will be generated.
-
-
-
-
- A default implementation of IQueryable for use with QueryProvider
-
-
-
-
- The is a
- static method that returns an IQueryable of Mocks of T which is used to
- apply the linq specification to.
-
-
-
-
- Allows creation custom value matchers that can be used on setups and verification,
- completely replacing the built-in class with your own argument
- matching rules.
-
- See also .
-
-
-
-
- Provided for the sole purpose of rendering the delegate passed to the
- matcher constructor if no friendly render lambda is provided.
-
-
-
-
- Initializes the match with the condition that
- will be checked in order to match invocation
- values.
- The condition to match against actual values.
-
-
-
-
-
-
-
-
- This method is used to set an expression as the last matcher invoked,
- which is used in the SetupSet to allow matchers in the prop = value
- delegate expression. This delegate is executed in "fluent" mode in
- order to capture the value being set, and construct the corresponding
- methodcall.
- This is also used in the MatcherFactory for each argument expression.
- This method ensures that when we execute the delegate, we
- also track the matcher that was invoked, so that when we create the
- methodcall we build the expression using it, rather than the null/default
- value returned from the actual invocation.
-
-
-
-
- Allows creation custom value matchers that can be used on setups and verification,
- completely replacing the built-in class with your own argument
- matching rules.
- Type of the value to match.
- The argument matching is used to determine whether a concrete
- invocation in the mock matches a given setup. This
- matching mechanism is fully extensible.
-
- Creating a custom matcher is straightforward. You just need to create a method
- that returns a value from a call to with
- your matching condition and optional friendly render expression:
-
- [Matcher]
- public Order IsBigOrder()
- {
- return Match<Order>.Create(
- o => o.GrandTotal >= 5000,
- /* a friendly expression to render on failures */
- () => IsBigOrder());
- }
-
- This method can be used in any mock setup invocation:
-
- mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>();
-
- At runtime, Moq knows that the return value was a matcher (note that the method MUST be
- annotated with the [Matcher] attribute in order to determine this) and
- evaluates your predicate with the actual value passed into your predicate.
-
- Another example might be a case where you want to match a lists of orders
- that contains a particular one. You might create matcher like the following:
-
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order));
- }
- }
-
- Now we can invoke this static method instead of an argument in an
- invocation:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
-
-
-
-
- Tracks the current mock and interception context.
-
-
-
-
- Having an active fluent mock context means that the invocation
- is being performed in "trial" mode, just to gather the
- target method and arguments that need to be matched later
- when the actual invocation is made.
-
-
-
-
- A that returns an empty default value
- for non-mockeable types, and mocks for all other types (interfaces and
- non-sealed classes) that can be mocked.
-
-
-
-
- Allows querying the universe of mocks for those that behave
- according to the LINQ query specification.
-
-
- This entry-point into Linq to Mocks is the only one in the root Moq
- namespace to ease discovery. But to get all the mocking extension
- methods on Object, a using of Moq.Linq must be done, so that the
- polluting of the intellisense for all objects is an explicit opt-in.
-
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The type of the mocked object to query.
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The predicate with the setup expressions.
- The type of the mocked object to query.
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the setup expressions.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates the mock query with the underlying queriable implementation.
-
-
-
-
- Wraps the enumerator inside a queryable.
-
-
-
-
- Method that is turned into the actual call from .Query{T}, to
- transform the queryable query into a normal enumerable query.
- This method is never used directly by consumers.
-
-
-
-
- Extension method used to support Linq-like setup properties that are not virtual but do have
- a getter and a setter, thereby allowing the use of Linq to Mocks to quickly initialize Dtos too :)
-
-
-
-
- Helper extensions that are used by the query translator.
-
-
-
-
- Retrieves a fluent mock from the given setup expression.
-
-
-
-
- Defines the number of invocations allowed by a mocked method.
-
-
-
-
- Specifies that a mocked method should be invoked times as minimum.
- The minimun number of times.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked one time as minimum.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked time as maximun.
- The maximun number of times.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked one time as maximun.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked between and
- times.
- The minimun number of times.The maximun number of times.
- The kind of range. See .
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked exactly times.
- The times that a method or property can be called.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should not be invoked.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked exactly one time.
- An object defining the allowed number of invocations.
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- true if the specified is equal to this instance; otherwise, false.
-
-
-
-
- Returns a hash code for this instance.
-
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
-
-
-
-
- Determines whether two specified objects have the same value.
-
- The first .
-
- The second .
-
- true if the value of left is the same as the value of right; otherwise, false.
-
-
-
-
- Determines whether two specified objects have different values.
-
- The first .
-
- The second .
-
- true if the value of left is different from the value of right; otherwise, false.
-
-
-
-
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Castle.Core.dll b/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Castle.Core.dll
deleted file mode 100644
index a887ecd..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Castle.Core.dll and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.dll b/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.dll
deleted file mode 100644
index fb516c1..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.dll and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.pdb b/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.pdb
deleted file mode 100644
index d33d394..0000000
Binary files a/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.pdb and /dev/null differ
diff --git a/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.xml b/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.xml
deleted file mode 100644
index 90efe10..0000000
--- a/RESW File Code Generator/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.xml
+++ /dev/null
@@ -1,5101 +0,0 @@
-
-
-
- Moq.Silverlight
-
-
-
-
- Provides a mock implementation of .
-
- Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked.
-
- The behavior of the mock with regards to the setups and the actual calls is determined
- by the optional that can be passed to the
- constructor.
-
- Type to mock, which can be an interface or a class.
- The following example shows establishing setups with specific values
- for method invocations:
-
- // Arrange
- var order = new Order(TALISKER, 50);
- var mock = new Mock<IWarehouse>();
-
- mock.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true);
-
- // Act
- order.Fill(mock.Object);
-
- // Assert
- Assert.True(order.IsFilled);
-
- The following example shows how to use the class
- to specify conditions for arguments instead of specific values:
-
- // Arrange
- var order = new Order(TALISKER, 50);
- var mock = new Mock<IWarehouse>();
-
- // shows how to expect a value within a range
- mock.Setup(x => x.HasInventory(
- It.IsAny<string>(),
- It.IsInRange(0, 100, Range.Inclusive)))
- .Returns(false);
-
- // shows how to throw for unexpected calls.
- mock.Setup(x => x.Remove(
- It.IsAny<string>(),
- It.IsAny<int>()))
- .Throws(new InvalidOperationException());
-
- // Act
- order.Fill(mock.Object);
-
- // Assert
- Assert.False(order.IsFilled);
-
-
-
-
-
- Base class for mocks and static helper class with methods that
- apply to mocked objects, such as to
- retrieve a from an object instance.
-
-
-
-
- Helper interface used to hide the base
- members from the fluent API to make it much cleaner
- in Visual Studio intellisense.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the specification of how the mocked object should behave.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Retrieves the mock object for the given object instance.
-
- Type of the mock to retrieve. Can be omitted as it's inferred
- from the object instance passed in as the instance.
- The instance of the mocked object.The mock associated with the mocked object.
- The received instance
- was not created by Moq.
-
- The following example shows how to add a new setup to an object
- instance which is not the original but rather
- the object associated with it:
-
- // Typed instance, not the mock, is retrieved from some test API.
- HttpContextBase context = GetMockContext();
-
- // context.Request is the typed object from the "real" API
- // so in order to add a setup to it, we need to get
- // the mock that "owns" it
- Mock<HttpRequestBase> request = Mock.Get(context.Request);
- mock.Setup(req => req.AppRelativeCurrentExecutionFilePath)
- .Returns(tempUrl);
-
-
-
-
-
- Returns the mocked object value.
-
-
-
-
- Verifies that all verifiable expectations have been met.
-
- This example sets up an expectation and marks it as verifiable. After
- the mock is used, a Verify() call is issued on the mock
- to ensure the method in the setup was invoked:
-
- var mock = new Mock<IWarehouse>();
- this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true);
- ...
- // other test code
- ...
- // Will throw if the test code has didn't call HasInventory.
- this.Verify();
-
- Not all verifiable expectations were met.
-
-
-
- Verifies all expectations regardless of whether they have
- been flagged as verifiable.
-
- This example sets up an expectation without marking it as verifiable. After
- the mock is used, a call is issued on the mock
- to ensure that all expectations are met:
-
- var mock = new Mock<IWarehouse>();
- this.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true);
- ...
- // other test code
- ...
- // Will throw if the test code has didn't call HasInventory, even
- // that expectation was not marked as verifiable.
- this.VerifyAll();
-
- At least one expectation was not met.
-
-
-
- Gets the interceptor target for the given expression and root mock,
- building the intermediate hierarchy of mock objects if necessary.
-
-
-
-
- Raises the associated event with the given
- event argument data.
-
-
-
-
- Raises the associated event with the given
- event argument data.
-
-
-
-
- Adds an interface implementation to the mock,
- allowing setups to be specified for it.
-
- This method can only be called before the first use
- of the mock property, at which
- point the runtime type has already been generated
- and no more interfaces can be added to it.
-
- Also, must be an
- interface and not a class, which must be specified
- when creating the mock instead.
-
-
- The mock type
- has already been generated by accessing the property.
-
- The specified
- is not an interface.
-
- The following example creates a mock for the main interface
- and later adds to it to verify
- it's called by the consumer code:
-
- var mock = new Mock<IProcessor>();
- mock.Setup(x => x.Execute("ping"));
-
- // add IDisposable interface
- var disposable = mock.As<IDisposable>();
- disposable.Setup(d => d.Dispose()).Verifiable();
-
- Type of interface to cast the mock to.
-
-
-
-
-
-
- Behavior of the mock, according to the value set in the constructor.
-
-
-
-
- Whether the base member virtual implementation will be called
- for mocked classes if no setup is matched. Defaults to .
-
-
-
-
- Specifies the behavior to use when returning default values for
- unexpected invocations on loose mocks.
-
-
-
-
- Gets the mocked object instance.
-
-
-
-
- Retrieves the type of the mocked object, its generic type argument.
- This is used in the auto-mocking of hierarchy access.
-
-
-
-
- Specifies the class that will determine the default
- value to return when invocations are made that
- have no setups and need to return a default
- value (for loose mocks).
-
-
-
-
- Exposes the list of extra interfaces implemented by the mock.
-
-
-
-
- Ctor invoked by AsTInterface exclusively.
-
-
-
-
- Initializes an instance of the mock with default behavior.
-
- var mock = new Mock<IFormatProvider>();
-
-
-
-
- Initializes an instance of the mock with default behavior and with
- the given constructor arguments for the class. (Only valid when is a class)
-
- The mock will try to find the best match constructor given the constructor arguments, and invoke that
- to initialize the instance. This applies only for classes, not interfaces.
-
- var mock = new Mock<MyProvider>(someArgument, 25);
- Optional constructor arguments if the mocked type is a class.
-
-
-
- Initializes an instance of the mock with the specified behavior.
-
- var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed);
- Behavior of the mock.
-
-
-
- Initializes an instance of the mock with a specific behavior with
- the given constructor arguments for the class.
-
- The mock will try to find the best match constructor given the constructor arguments, and invoke that
- to initialize the instance. This applies only to classes, not interfaces.
-
- var mock = new Mock<MyProvider>(someArgument, 25);
- Behavior of the mock.Optional constructor arguments if the mocked type is a class.
-
-
-
- Returns the mocked object value.
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a void method.
-
- If more than one setup is specified for the same method or property,
- the latest one wins and is the one that will be executed.
- Lambda expression that specifies the expected method invocation.
-
- var mock = new Mock<IProcessor>();
- mock.Setup(x => x.Execute("ping"));
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a value returning method.
- Type of the return value. Typically omitted as it can be inferred from the expression.
- If more than one setup is specified for the same method or property,
- the latest one wins and is the one that will be executed.
- Lambda expression that specifies the method invocation.
-
- mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property getter.
-
- If more than one setup is set for the same property getter,
- the latest one wins and is the one that will be executed.
- Type of the property. Typically omitted as it can be inferred from the expression.Lambda expression that specifies the property getter.
-
- mock.SetupGet(x => x.Suspended)
- .Returns(true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter.
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
-
- This overloads allows the use of a callback already
- typed for the property type.
-
- Type of the property. Typically omitted as it can be inferred from the expression.The Lambda expression that sets a property to a value.
-
- mock.SetupSet(x => x.Suspended = true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter.
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
- Lambda expression that sets a property to a value.
-
- mock.SetupSet(x => x.Suspended = true);
-
-
-
-
-
- Specifies that the given property should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. (this is also
- known as "stubbing").
-
- Type of the property, inferred from the property
- expression (does not need to be specified).
- Property expression to stub.
- If you have an interface with an int property Value, you might
- stub it using the following straightforward call:
-
- var mock = new Mock<IHaveValue>();
- mock.Stub(v => v.Value);
-
- After the Stub call has been issued, setting and
- retrieving the object value will behave as expected:
-
- IHaveValue v = mock.Object;
-
- v.Value = 5;
- Assert.Equal(5, v.Value);
-
-
-
-
-
- Specifies that the given property should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. This overload
- allows setting the initial value for the property. (this is also
- known as "stubbing").
-
- Type of the property, inferred from the property
- expression (does not need to be specified).
- Property expression to stub.Initial value for the property.
- If you have an interface with an int property Value, you might
- stub it using the following straightforward call:
-
- var mock = new Mock<IHaveValue>();
- mock.SetupProperty(v => v.Value, 5);
-
- After the SetupProperty call has been issued, setting and
- retrieving the object value will behave as expected:
-
- IHaveValue v = mock.Object;
- // Initial value was stored
- Assert.Equal(5, v.Value);
-
- // New value set which changes the initial value
- v.Value = 6;
- Assert.Equal(6, v.Value);
-
-
-
-
-
- Specifies that the all properties on the mock should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. (this is also
- known as "stubbing"). The default value for each property will be the
- one generated as specified by the property for the mock.
-
- If the mock is set to ,
- the mocked default values will also get all properties setup recursively.
-
-
-
-
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IProcessor>();
- // exercise mock
- //...
- // Will throw if the test code didn't call Execute with a "ping" string argument.
- mock.Verify(proc => proc.Execute("ping"));
-
- The invocation was not performed on the mock.Expression to verify.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock,
- specifying a failure error message. Use in conjuntion with the default
- .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IProcessor>();
- // exercise mock
- //...
- // Will throw if the test code didn't call Execute with a "ping" string argument.
- mock.Verify(proc => proc.Execute("ping"));
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock,
- specifying a failure error message. Use in conjuntion with the default
- .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't call HasInventory.
- mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50));
-
- The invocation was not performed on the mock.Expression to verify.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock. Use in conjuntion
- with the default .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock, specifying a failure
- error message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't call HasInventory.
- mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50), "When filling orders, inventory has to be checked");
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock, specifying a failure
- error message.
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.Type of return value from the expression.
-
-
-
- Verifies that a property was read on the mock.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was retrieved from it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't retrieve the IsClosed property.
- mock.VerifyGet(warehouse => warehouse.IsClosed);
-
- The invocation was not performed on the mock.Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock, specifying a failure
- error message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was retrieved from it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't retrieve the IsClosed property.
- mock.VerifyGet(warehouse => warehouse.IsClosed);
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock, specifying a failure
- error message.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was set on the mock.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was set on it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed = true);
-
- The invocation was not performed on the mock.Expression to verify.
-
-
-
- Verifies that a property was set on the mock.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.
-
-
-
- Verifies that a property was set on the mock, specifying
- a failure message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was set on it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action");
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
-
-
-
- Verifies that a property was set on the mock, specifying
- a failure message.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails.
-
-
-
- Raises the event referenced in using
- the given argument.
-
- The argument is
- invalid for the target event invocation, or the is
- not an event attach or detach expression.
-
- The following example shows how to raise a event:
-
- var mock = new Mock<IViewModel>();
-
- mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name"));
-
-
- This example shows how to invoke an event with a custom event arguments
- class in a view that will cause its corresponding presenter to
- react by changing its state:
-
- var mockView = new Mock<IOrdersView>();
- var presenter = new OrdersPresenter(mockView.Object);
-
- // Check that the presenter has no selection by default
- Assert.Null(presenter.SelectedOrder);
-
- // Raise the event with a specific arguments data
- mockView.Raise(v => v.SelectionChanged += null, new OrderEventArgs { Order = new Order("moq", 500) });
-
- // Now the presenter reacted to the event, and we have a selected order
- Assert.NotNull(presenter.SelectedOrder);
- Assert.Equal("moq", presenter.SelectedOrder.ProductName);
-
-
-
-
-
- Raises the event referenced in using
- the given argument for a non-EventHandler typed event.
-
- The arguments are
- invalid for the target event invocation, or the is
- not an event attach or detach expression.
-
- The following example shows how to raise a custom event that does not adhere to
- the standard EventHandler:
-
- var mock = new Mock<IViewModel>();
-
- mock.Raise(x => x.MyEvent -= null, "Name", bool, 25);
-
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Exposes the mocked object instance.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- The expectation will be considered only in the former condition.
-
-
-
-
-
-
- The expectation will be considered only in the former condition.
-
-
-
-
-
-
-
- Setups the get.
-
- The type of the property.
- The expression.
-
-
-
-
- Setups the set.
-
- The type of the property.
- The setter expression.
-
-
-
-
- Setups the set.
-
- The setter expression.
-
-
-
-
- Determines the way default values are generated
- calculated for loose mocks.
-
-
-
-
- Default behavior, which generates empty values for
- value types (i.e. default(int)), empty array and
- enumerables, and nulls for all other reference types.
-
-
-
-
- Whenever the default value generated by
- is null, replaces this value with a mock (if the type
- can be mocked).
-
-
- For sealed classes, a null value will be generated.
-
-
-
-
- A that returns an empty default value
- for invocations that do not have setups or return values, with loose mocks.
- This is the default behavior for a mock.
-
-
-
-
- Interface to be implemented by classes that determine the
- default value of non-expected invocations.
-
-
-
-
- Defines the default value to return in all the methods returning .
- The type of the return value.The value to set as default.
-
-
-
- Provides a value for the given member and arguments.
-
- The member to provide a default value for.
-
-
-
-
- Provides partial evaluation of subtrees, whenever they can be evaluated locally.
-
- Matt Warren: http://blogs.msdn.com/mattwar
- Documented by InSTEDD: http://www.instedd.org
-
-
-
- Performs evaluation and replacement of independent sub-trees
-
- The root of the expression tree.
- A function that decides whether a given expression
- node can be part of the local function.
- A new tree with sub-trees evaluated and replaced.
-
-
-
- Performs evaluation and replacement of independent sub-trees
-
- The root of the expression tree.
- A new tree with sub-trees evaluated and replaced.
-
-
-
- Evaluates and replaces sub-trees when first candidate is reached (top-down)
-
-
-
-
- Performs bottom-up analysis to determine which nodes can possibly
- be part of an evaluated sub-tree.
-
-
-
-
- Casts the expression to a lambda expression, removing
- a cast if there's any.
-
-
-
-
- Casts the body of the lambda expression to a .
-
- If the body is not a method call.
-
-
-
- Converts the body of the lambda expression into the referenced by it.
-
-
-
-
- Checks whether the body of the lambda expression is a property access.
-
-
-
-
- Checks whether the expression is a property access.
-
-
-
-
- Checks whether the body of the lambda expression is a property indexer, which is true
- when the expression is an whose
- has
- equal to .
-
-
-
-
- Checks whether the expression is a property indexer, which is true
- when the expression is an whose
- has
- equal to .
-
-
-
-
- Creates an expression that casts the given expression to the
- type.
-
-
-
-
- TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583
- is fixed.
-
-
-
-
- The intention of is to create a more readable
- string representation for the failure message.
-
-
-
-
- Tracks the current mock and interception context.
-
-
-
-
- Having an active fluent mock context means that the invocation
- is being performed in "trial" mode, just to gather the
- target method and arguments that need to be matched later
- when the actual invocation is made.
-
-
-
-
- Ensures the given is not null.
- Throws otherwise.
-
-
-
-
- Ensures the given string is not null or empty.
- Throws in the first case, or
- in the latter.
-
-
-
-
- Checks an argument to ensure it is in the specified range including the edges.
-
- Type of the argument to check, it must be an type.
-
- The expression containing the name of the argument.
- The argument value to check.
- The minimun allowed value for the argument.
- The maximun allowed value for the argument.
-
-
-
- Checks an argument to ensure it is in the specified range excluding the edges.
-
- Type of the argument to check, it must be an type.
-
- The expression containing the name of the argument.
- The argument value to check.
- The minimun allowed value for the argument.
- The maximun allowed value for the argument.
-
-
-
- Implemented by all generated mock object instances.
-
-
-
-
- Implemented by all generated mock object instances.
-
-
-
-
- Reference the Mock that contains this as the mock.Object value.
-
-
-
-
- Reference the Mock that contains this as the mock.Object value.
-
-
-
-
- Implements the actual interception and method invocation for
- all mocks.
-
-
-
-
- Get an eventInfo for a given event name. Search type ancestors depth first if necessary.
-
- Name of the event, with the set_ or get_ prefix already removed
-
-
-
- Given a type return all of its ancestors, both types and interfaces.
-
- The type to find immediate ancestors of
-
-
-
- Allows the specification of a matching condition for an
- argument in a method invocation, rather than a specific
- argument value. "It" refers to the argument being matched.
-
- This class allows the setup to match a method invocation
- with an arbitrary value, with a value in a specified range, or
- even one that matches a given predicate.
-
-
-
-
- Matches any value of the given type.
-
- Typically used when the actual argument value for a method
- call is not relevant.
-
-
- // Throws an exception for a call to Remove with any string value.
- mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException());
-
- Type of the value.
-
-
-
- Matches any value that satisfies the given predicate.
- Type of the argument to check.The predicate used to match the method argument.
- Allows the specification of a predicate to perform matching
- of method call arguments.
-
- This example shows how to return the value 1 whenever the argument to the
- Do method is an even number.
-
- mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0)))
- .Returns(1);
-
- This example shows how to throw an exception if the argument to the
- method is a negative number:
-
- mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0)))
- .Throws(new ArgumentException());
-
-
-
-
-
- Matches any value that is in the range specified.
- Type of the argument to check.The lower bound of the range.The upper bound of the range.
- The kind of range. See .
-
- The following example shows how to expect a method call
- with an integer argument within the 0..100 range.
-
- mock.Setup(x => x.HasInventory(
- It.IsAny<string>(),
- It.IsInRange(0, 100, Range.Inclusive)))
- .Returns(false);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
- The pattern to use to match the string argument value.
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression:
-
- mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
- The pattern to use to match the string argument value.The options used to interpret the pattern.
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression, in a case insensitive way:
-
- mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1);
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb and overloads.
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3) => Console.WriteLine(arg1 + arg2 + arg3));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16));
-
-
-
-
-
- Specifies a callback to invoke when the method is called.
-
- The callback method to invoke.
-
- The following example specifies a callback to set a boolean
- value that can be used later:
-
- var called = false;
- mock.Setup(x => x.Execute())
- .Callback(() => called = true);
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The argument type of the invoked method.
- The callback method to invoke.
-
- Invokes the given callback with the concrete invocation argument value.
-
- Notice how the specific string argument is retrieved by simply declaring
- it as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Callback((string command) => Console.WriteLine(command));
-
-
-
-
-
- Defines occurrence members to constraint setups.
-
-
-
-
- The expected invocation can happen at most once.
-
-
-
- var mock = new Mock<ICommand>();
- mock.Setup(foo => foo.Execute("ping"))
- .AtMostOnce();
-
-
-
-
-
- The expected invocation can happen at most specified number of times.
-
- The number of times to accept calls.
-
-
- var mock = new Mock<ICommand>();
- mock.Setup(foo => foo.Execute("ping"))
- .AtMost( 5 );
-
-
-
-
-
- Defines the Raises verb.
-
-
-
-
- Specifies the event that will be raised
- when the setup is met.
-
- An expression that represents an event attach or detach action.
- The event arguments to pass for the raised event.
-
- The following example shows how to raise an event when
- the setup is met:
-
- var mock = new Mock<IContainer>();
-
- mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>()))
- .Raises(add => add.Added += null, EventArgs.Empty);
-
-
-
-
-
- Specifies the event that will be raised
- when the setup is matched.
-
- An expression that represents an event attach or detach action.
- A function that will build the
- to pass when raising the event.
-
-
-
-
- Specifies the custom event that will be raised
- when the setup is matched.
-
- An expression that represents an event attach or detach action.
- The arguments to pass to the custom delegate (non EventHandler-compatible).
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
- The type of the fifteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
- The type of the fifteenth argument received by the expected invocation.
- The type of the sixteenth argument received by the expected invocation.
-
-
-
-
- Defines the Verifiable verb.
-
-
-
-
- Marks the expectation as verifiable, meaning that a call
- to will check if this particular
- expectation was met.
-
-
- The following example marks the expectation as verifiable:
-
- mock.Expect(x => x.Execute("ping"))
- .Returns(true)
- .Verifiable();
-
-
-
-
-
- Marks the expectation as verifiable, meaning that a call
- to will check if this particular
- expectation was met, and specifies a message for failures.
-
-
- The following example marks the expectation as verifiable:
-
- mock.Expect(x => x.Execute("ping"))
- .Returns(true)
- .Verifiable("Ping should be executed always!");
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Throws verb.
-
-
-
-
- Specifies the exception to throw when the method is invoked.
-
- Exception instance to throw.
-
- This example shows how to throw an exception when the method is
- invoked with an empty string argument:
-
- mock.Setup(x => x.Execute(""))
- .Throws(new ArgumentException());
-
-
-
-
-
- Specifies the type of exception to throw when the method is invoked.
-
- Type of exception to instantiate and throw when the setup is matched.
-
- This example shows how to throw an exception when the method is
- invoked with an empty string argument:
-
- mock.Setup(x => x.Execute(""))
- .Throws<ArgumentException>();
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb and overloads for callbacks on
- setups that return a value.
-
- Mocked type.
- Type of the return value of the setup.
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2) => Console.WriteLine(arg1 + arg2));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3) => Console.WriteLine(arg1 + arg2 + arg3));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- 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) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- 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));
-
-
-
-
-
- Specifies a callback to invoke when the method is called.
-
- The callback method to invoke.
-
- The following example specifies a callback to set a boolean value that can be used later:
-
- var called = false;
- mock.Setup(x => x.Execute())
- .Callback(() => called = true)
- .Returns(true);
-
- Note that in the case of value-returning methods, after the Callback
- call you can still specify the return value.
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the argument of the invoked method.
- Callback method to invoke.
-
- Invokes the given callback with the concrete invocation argument value.
-
- Notice how the specific string argument is retrieved by simply declaring
- it as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Callback(command => Console.WriteLine(command))
- .Returns(true);
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Returns verb.
-
- Mocked type.
- Type of the return value from the expression.
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2) => arg1 + arg2);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3) => arg1 + arg2 + arg3);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4) => arg1 + arg2 + arg3 + arg4);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5) => arg1 + arg2 + arg3 + arg4 + arg5);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- 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((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16);
-
-
-
-
-
- Specifies the value to return.
-
- The value to return, or .
-
- Return a true value from the method call:
-
- mock.Setup(x => x.Execute("ping"))
- .Returns(true);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method.
-
- The function that will calculate the return value.
-
- Return a calculated value when the method is called:
-
- mock.Setup(x => x.Execute("ping"))
- .Returns(() => returnValues[0]);
-
- The lambda expression to retrieve the return value is lazy-executed,
- meaning that its value may change depending on the moment the method
- is executed and the value the returnValues array has at
- that moment.
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the argument of the invoked method.
- The function that will calculate the return value.
-
- Return a calculated value which is evaluated lazily at the time of the invocation.
-
- The lookup list can change between invocations and the setup
- will return different values accordingly. Also, notice how the specific
- string argument is retrieved by simply declaring it as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Returns((string command) => returnValues[command]);
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb for property getter setups.
-
-
- Mocked type.
- Type of the property.
-
-
-
- Specifies a callback to invoke when the property is retrieved.
-
- Callback method to invoke.
-
- Invokes the given callback with the property value being set.
-
- mock.SetupGet(x => x.Suspended)
- .Callback(() => called = true)
- .Returns(true);
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Returns verb for property get setups.
-
- Mocked type.
- Type of the property.
-
-
-
- Specifies the value to return.
-
- The value to return, or .
-
- Return a true value from the property getter call:
-
- mock.SetupGet(x => x.Suspended)
- .Returns(true);
-
-
-
-
-
- Specifies a function that will calculate the value to return for the property.
-
- The function that will calculate the return value.
-
- Return a calculated value when the property is retrieved:
-
- mock.SetupGet(x => x.Suspended)
- .Returns(() => returnValues[0]);
-
- The lambda expression to retrieve the return value is lazy-executed,
- meaning that its value may change depending on the moment the property
- is retrieved and the value the returnValues array has at
- that moment.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb for property setter setups.
-
- Type of the property.
-
-
-
- Specifies a callback to invoke when the property is set that receives the
- property value being set.
-
- Callback method to invoke.
-
- Invokes the given callback with the property value being set.
-
- mock.SetupSet(x => x.Suspended)
- .Callback((bool state) => Console.WriteLine(state));
-
-
-
-
-
- Language for ReturnSequence
-
-
-
-
- Returns value
-
-
-
-
- Throws an exception
-
-
-
-
- Throws an exception
-
-
-
-
- The first method call or member access will be the
- last segment of the expression (depth-first traversal),
- which is the one we have to Setup rather than FluentMock.
- And the last one is the one we have to Mock.Get rather
- than FluentMock.
-
-
-
-
- A default implementation of IQueryable for use with QueryProvider
-
-
-
-
- The is a
- static method that returns an IQueryable of Mocks of T which is used to
- apply the linq specification to.
-
-
-
-
- Utility repository class to use to construct multiple
- mocks when consistent verification is
- desired for all of them.
-
-
- If multiple mocks will be created during a test, passing
- the desired (if different than the
- or the one
- passed to the repository constructor) and later verifying each
- mock can become repetitive and tedious.
-
- This repository class helps in that scenario by providing a
- simplified creation of multiple mocks with a default
- (unless overriden by calling
- ) and posterior verification.
-
-
-
- The following is a straightforward example on how to
- create and automatically verify strict mocks using a :
-
- var repository = new MockRepository(MockBehavior.Strict);
-
- var foo = repository.Create<IFoo>();
- var bar = repository.Create<IBar>();
-
- // no need to call Verifiable() on the setup
- // as we'll be validating all of them anyway.
- foo.Setup(f => f.Do());
- bar.Setup(b => b.Redo());
-
- // exercise the mocks here
-
- repository.VerifyAll();
- // At this point all setups are already checked
- // and an optional MockException might be thrown.
- // Note also that because the mocks are strict, any invocation
- // that doesn't have a matching setup will also throw a MockException.
-
- The following examples shows how to setup the repository
- to create loose mocks and later verify only verifiable setups:
-
- var repository = new MockRepository(MockBehavior.Loose);
-
- var foo = repository.Create<IFoo>();
- var bar = repository.Create<IBar>();
-
- // this setup will be verified when we verify the repository
- foo.Setup(f => f.Do()).Verifiable();
-
- // this setup will NOT be verified
- foo.Setup(f => f.Calculate());
-
- // this setup will be verified when we verify the repository
- bar.Setup(b => b.Redo()).Verifiable();
-
- // exercise the mocks here
- // note that because the mocks are Loose, members
- // called in the interfaces for which no matching
- // setups exist will NOT throw exceptions,
- // and will rather return default values.
-
- repository.Verify();
- // At this point verifiable setups are already checked
- // and an optional MockException might be thrown.
-
- The following examples shows how to setup the repository with a
- default strict behavior, overriding that default for a
- specific mock:
-
- var repository = new MockRepository(MockBehavior.Strict);
-
- // this particular one we want loose
- var foo = repository.Create<IFoo>(MockBehavior.Loose);
- var bar = repository.Create<IBar>();
-
- // specify setups
-
- // exercise the mocks here
-
- repository.Verify();
-
-
-
-
-
-
- Utility factory class to use to construct multiple
- mocks when consistent verification is
- desired for all of them.
-
-
- If multiple mocks will be created during a test, passing
- the desired (if different than the
- or the one
- passed to the factory constructor) and later verifying each
- mock can become repetitive and tedious.
-
- This factory class helps in that scenario by providing a
- simplified creation of multiple mocks with a default
- (unless overriden by calling
- ) and posterior verification.
-
-
-
- The following is a straightforward example on how to
- create and automatically verify strict mocks using a :
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>();
- var bar = factory.Create<IBar>();
-
- // no need to call Verifiable() on the setup
- // as we'll be validating all of them anyway.
- foo.Setup(f => f.Do());
- bar.Setup(b => b.Redo());
-
- // exercise the mocks here
-
- factory.VerifyAll();
- // At this point all setups are already checked
- // and an optional MockException might be thrown.
- // Note also that because the mocks are strict, any invocation
- // that doesn't have a matching setup will also throw a MockException.
-
- The following examples shows how to setup the factory
- to create loose mocks and later verify only verifiable setups:
-
- var factory = new MockFactory(MockBehavior.Loose);
-
- var foo = factory.Create<IFoo>();
- var bar = factory.Create<IBar>();
-
- // this setup will be verified when we verify the factory
- foo.Setup(f => f.Do()).Verifiable();
-
- // this setup will NOT be verified
- foo.Setup(f => f.Calculate());
-
- // this setup will be verified when we verify the factory
- bar.Setup(b => b.Redo()).Verifiable();
-
- // exercise the mocks here
- // note that because the mocks are Loose, members
- // called in the interfaces for which no matching
- // setups exist will NOT throw exceptions,
- // and will rather return default values.
-
- factory.Verify();
- // At this point verifiable setups are already checked
- // and an optional MockException might be thrown.
-
- The following examples shows how to setup the factory with a
- default strict behavior, overriding that default for a
- specific mock:
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- // this particular one we want loose
- var foo = factory.Create<IFoo>(MockBehavior.Loose);
- var bar = factory.Create<IBar>();
-
- // specify setups
-
- // exercise the mocks here
-
- factory.Verify();
-
-
-
-
-
-
- Initializes the factory with the given
- for newly created mocks from the factory.
-
- The behavior to use for mocks created
- using the factory method if not overriden
- by using the overload.
-
-
-
- Creates a new mock with the default
- specified at factory construction time.
-
- Type to mock.
- A new .
-
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>();
- // use mock on tests
-
- factory.VerifyAll();
-
-
-
-
-
- Creates a new mock with the default
- specified at factory construction time and with the
- the given constructor arguments for the class.
-
-
- The mock will try to find the best match constructor given the
- constructor arguments, and invoke that to initialize the instance.
- This applies only to classes, not interfaces.
-
- Type to mock.
- Constructor arguments for mocked classes.
- A new .
-
-
- var factory = new MockFactory(MockBehavior.Default);
-
- var mock = factory.Create<MyBase>("Foo", 25, true);
- // use mock on tests
-
- factory.Verify();
-
-
-
-
-
- Creates a new mock with the given .
-
- Type to mock.
- Behavior to use for the mock, which overrides
- the default behavior specified at factory construction time.
- A new .
-
- The following example shows how to create a mock with a different
- behavior to that specified as the default for the factory:
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>(MockBehavior.Loose);
-
-
-
-
-
- Creates a new mock with the given
- and with the the given constructor arguments for the class.
-
-
- The mock will try to find the best match constructor given the
- constructor arguments, and invoke that to initialize the instance.
- This applies only to classes, not interfaces.
-
- Type to mock.
- Behavior to use for the mock, which overrides
- the default behavior specified at factory construction time.
- Constructor arguments for mocked classes.
- A new .
-
- The following example shows how to create a mock with a different
- behavior to that specified as the default for the factory, passing
- constructor arguments:
-
- var factory = new MockFactory(MockBehavior.Default);
-
- var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true);
-
-
-
-
-
- Implements creation of a new mock within the factory.
-
- Type to mock.
- The behavior for the new mock.
- Optional arguments for the construction of the mock.
-
-
-
- Verifies all verifiable expectations on all mocks created
- by this factory.
-
-
- One or more mocks had expectations that were not satisfied.
-
-
-
- Verifies all verifiable expectations on all mocks created
- by this factory.
-
-
- One or more mocks had expectations that were not satisfied.
-
-
-
- Invokes for each mock
- in , and accumulates the resulting
- that might be
- thrown from the action.
-
- The action to execute against
- each mock.
-
-
-
- Whether the base member virtual implementation will be called
- for mocked classes if no setup is matched. Defaults to .
-
-
-
-
- Specifies the behavior to use when returning default values for
- unexpected invocations on loose mocks.
-
-
-
-
- Gets the mocks that have been created by this factory and
- that will get verified together.
-
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The type of the mocked object to query.
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The predicate with the setup expressions.
- The type of the mocked object to query.
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the setup expressions.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates the mock query with the underlying queriable implementation.
-
-
-
-
- Wraps the enumerator inside a queryable.
-
-
-
-
- Method that is turned into the actual call from .Query{T}, to
- transform the queryable query into a normal enumerable query.
- This method is never used directly by consumers.
-
-
-
-
- Initializes the repository with the given
- for newly created mocks from the repository.
-
- The behavior to use for mocks created
- using the repository method if not overriden
- by using the overload.
-
-
-
- Allows querying the universe of mocks for those that behave
- according to the LINQ query specification.
-
-
- This entry-point into Linq to Mocks is the only one in the root Moq
- namespace to ease discovery. But to get all the mocking extension
- methods on Object, a using of Moq.Linq must be done, so that the
- polluting of the intellisense for all objects is an explicit opt-in.
-
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The type of the mocked object to query.
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The predicate with the setup expressions.
- The type of the mocked object to query.
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the setup expressions.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates the mock query with the underlying queriable implementation.
-
-
-
-
- Wraps the enumerator inside a queryable.
-
-
-
-
- Method that is turned into the actual call from .Query{T}, to
- transform the queryable query into a normal enumerable query.
- This method is never used directly by consumers.
-
-
-
-
- Extension method used to support Linq-like setup properties that are not virtual but do have
- a getter and a setter, thereby allowing the use of Linq to Mocks to quickly initialize Dtos too :)
-
-
-
-
- Helper extensions that are used by the query translator.
-
-
-
-
- Retrieves a fluent mock from the given setup expression.
-
-
-
-
- Allows creation custom value matchers that can be used on setups and verification,
- completely replacing the built-in class with your own argument
- matching rules.
-
- See also .
-
-
-
-
- Provided for the sole purpose of rendering the delegate passed to the
- matcher constructor if no friendly render lambda is provided.
-
-
-
-
- Initializes the match with the condition that
- will be checked in order to match invocation
- values.
- The condition to match against actual values.
-
-
-
-
-
-
-
-
- This method is used to set an expression as the last matcher invoked,
- which is used in the SetupSet to allow matchers in the prop = value
- delegate expression. This delegate is executed in "fluent" mode in
- order to capture the value being set, and construct the corresponding
- methodcall.
- This is also used in the MatcherFactory for each argument expression.
- This method ensures that when we execute the delegate, we
- also track the matcher that was invoked, so that when we create the
- methodcall we build the expression using it, rather than the null/default
- value returned from the actual invocation.
-
-
-
-
- Allows creation custom value matchers that can be used on setups and verification,
- completely replacing the built-in class with your own argument
- matching rules.
- Type of the value to match.
- The argument matching is used to determine whether a concrete
- invocation in the mock matches a given setup. This
- matching mechanism is fully extensible.
-
- Creating a custom matcher is straightforward. You just need to create a method
- that returns a value from a call to with
- your matching condition and optional friendly render expression:
-
- [Matcher]
- public Order IsBigOrder()
- {
- return Match<Order>.Create(
- o => o.GrandTotal >= 5000,
- /* a friendly expression to render on failures */
- () => IsBigOrder());
- }
-
- This method can be used in any mock setup invocation:
-
- mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>();
-
- At runtime, Moq knows that the return value was a matcher (note that the method MUST be
- annotated with the [Matcher] attribute in order to determine this) and
- evaluates your predicate with the actual value passed into your predicate.
-
- Another example might be a case where you want to match a lists of orders
- that contains a particular one. You might create matcher like the following:
-
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order));
- }
- }
-
- Now we can invoke this static method instead of an argument in an
- invocation:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
-
-
-
-
- Marks a method as a matcher, which allows complete replacement
- of the built-in class with your own argument
- matching rules.
-
-
- This feature has been deprecated in favor of the new
- and simpler .
-
-
- The argument matching is used to determine whether a concrete
- invocation in the mock matches a given setup. This
- matching mechanism is fully extensible.
-
-
- There are two parts of a matcher: the compiler matcher
- and the runtime matcher.
-
- -
- Compiler matcher
- Used to satisfy the compiler requirements for the
- argument. Needs to be a method optionally receiving any arguments
- you might need for the matching, but with a return type that
- matches that of the argument.
-
- Let's say I want to match a lists of orders that contains
- a particular one. I might create a compiler matcher like the following:
-
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return null;
- }
- }
-
- Now we can invoke this static method instead of an argument in an
- invocation:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
- Note that the return value from the compiler matcher is irrelevant.
- This method will never be called, and is just used to satisfy the
- compiler and to signal Moq that this is not a method that we want
- to be invoked at runtime.
-
-
- -
- Runtime matcher
-
- The runtime matcher is the one that will actually perform evaluation
- when the test is run, and is defined by convention to have the
- same signature as the compiler matcher, but where the return
- value is the first argument to the call, which contains the
- object received by the actual invocation at runtime:
-
- public static bool Contains(IEnumerable<Order> orders, Order order)
- {
- return orders.Contains(order);
- }
-
- At runtime, the mocked method will be invoked with a specific
- list of orders. This value will be passed to this runtime
- matcher as the first argument, while the second argument is the
- one specified in the setup (x.Save(Orders.Contains(order))).
-
- The boolean returned determines whether the given argument has been
- matched. If all arguments to the expected method are matched, then
- the setup matches and is evaluated.
-
-
-
-
-
- Using this extensible infrastructure, you can easily replace the entire
- set of matchers with your own. You can also avoid the
- typical (and annoying) lengthy expressions that result when you have
- multiple arguments that use generics.
-
-
- The following is the complete example explained above:
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return null;
- }
-
- public static bool Contains(IEnumerable<Order> orders, Order order)
- {
- return orders.Contains(order);
- }
- }
-
- And the concrete test using this matcher:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
- // use mock, invoke Save, and have the matcher filter.
-
-
-
-
-
- Matcher to treat static functions as matchers.
-
- mock.Setup(x => x.StringMethod(A.MagicString()));
-
- public static class A
- {
- [Matcher]
- public static string MagicString() { return null; }
- public static bool MagicString(string arg)
- {
- return arg == "magic";
- }
- }
-
- Will succeed if: mock.Object.StringMethod("magic");
- and fail with any other call.
-
-
-
-
- We need this non-generics base class so that
- we can use from
- generic code.
-
-
-
-
- Options to customize the behavior of the mock.
-
-
-
-
- Causes the mock to always throw
- an exception for invocations that don't have a
- corresponding setup.
-
-
-
-
- Will never throw exceptions, returning default
- values when necessary (null for reference types,
- zero for value types or empty enumerables and arrays).
-
-
-
-
- Default mock behavior, which equals .
-
-
-
-
- A that returns an empty default value
- for non-mockeable types, and mocks for all other types (interfaces and
- non-sealed classes) that can be mocked.
-
-
-
-
- Exception thrown by mocks when setups are not matched,
- the mock is not properly setup, etc.
-
-
- A distinct exception type is provided so that exceptions
- thrown by the mock can be differentiated in tests that
- expect other exceptions to be thrown (i.e. ArgumentException).
-
- Richer exception hierarchy/types are not provided as
- tests typically should not catch or expect exceptions
- from the mocks. These are typically the result of changes
- in the tested class or its collaborators implementation, and
- result in fixes in the mock setup so that they dissapear and
- allow the test to pass.
-
-
-
-
-
- Made internal as it's of no use for
- consumers, but it's important for
- our own tests.
-
-
-
-
- Used by the mock factory to accumulate verification
- failures.
-
-
-
-
- Helper class to setup a full trace between many mocks
-
-
-
-
- Initialize a trace setup
-
-
-
-
- Allow sequence to be repeated
-
-
-
-
- define nice api
-
-
-
-
- Perform an expectation in the trace.
-
-
-
-
- Provides legacy API members as extensions so that
- existing code continues to compile, but new code
- doesn't see then.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Provides additional methods on mocks.
-
-
- Provided as extension methods as they confuse the compiler
- with the overloads taking Action.
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter, regardless of its value.
-
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
-
- Type of the property. Typically omitted as it can be inferred from the expression.
- Type of the mock.
- The target mock for the setup.
- Lambda expression that specifies the property setter.
-
-
- mock.SetupSet(x => x.Suspended);
-
-
-
- This method is not legacy, but must be on an extension method to avoid
- confusing the compiler with the new Action syntax.
-
-
-
-
- Verifies that a property has been set on the mock, regarless of its value.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- Expression to verify.
- The mock instance.
- Mocked type.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, specifying a failure
- error message.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- Expression to verify.
- Message to show if verification fails.
- The mock instance.
- Mocked type.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, regardless
- of the value but only the specified number of times.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- The invocation was not call the times specified by
- .
- The mock instance.
- Mocked type.
- The number of times a method is allowed to be called.
- Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, regardless
- of the value but only the specified number of times, and specifying a failure
- error message.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- The invocation was not call the times specified by
- .
- The mock instance.
- Mocked type.
- The number of times a method is allowed to be called.
- Message to show if verification fails.
- Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Allows setups to be specified for protected members by using their
- name as a string, rather than strong-typing them which is not possible
- due to their visibility.
-
-
-
-
- Specifies a setup for a void method invocation with the given
- , optionally specifying arguments for the method call.
-
- The name of the void method to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
-
-
-
- Specifies a setup for an invocation on a property or a non void method with the given
- , optionally specifying arguments for the method call.
-
- The name of the method or property to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
- The return type of the method or property.
-
-
-
- Specifies a setup for an invocation on a property getter with the given
- .
-
- The name of the property.
- The type of the property.
-
-
-
- Specifies a setup for an invocation on a property setter with the given
- .
-
- The name of the property.
- The property value. If argument matchers are used,
- remember to use rather than .
- The type of the property.
-
-
-
- Specifies a verify for a void method with the given ,
- optionally specifying arguments for the method call. Use in conjuntion with the default
- .
-
- The invocation was not call the times specified by
- .
- The name of the void method to be verified.
- The number of times a method is allowed to be called.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
-
-
-
- Specifies a verify for an invocation on a property or a non void method with the given
- , optionally specifying arguments for the method call.
-
- The invocation was not call the times specified by
- .
- The name of the method or property to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
- The number of times a method is allowed to be called.
- The type of return value from the expression.
-
-
-
- Specifies a verify for an invocation on a property getter with the given
- .
- The invocation was not call the times specified by
- .
-
- The name of the property.
- The number of times a method is allowed to be called.
- The type of the property.
-
-
-
- Specifies a setup for an invocation on a property setter with the given
- .
-
- The invocation was not call the times specified by
- .
- The name of the property.
- The number of times a method is allowed to be called.
- The property value.
- The type of the property. If argument matchers are used,
- remember to use rather than .
-
-
-
- Allows the specification of a matching condition for an
- argument in a protected member setup, rather than a specific
- argument value. "ItExpr" refers to the argument being matched.
-
-
- Use this variant of argument matching instead of
- for protected setups.
- This class allows the setup to match a method invocation
- with an arbitrary value, with a value in a specified range, or
- even one that matches a given predicate, or null.
-
-
-
-
- Matches a null value of the given type.
-
-
- Required for protected mocks as the null value cannot be used
- directly as it prevents proper method overload selection.
-
-
-
- // Throws an exception for a call to Remove with a null string value.
- mock.Protected()
- .Setup("Remove", ItExpr.IsNull<string>())
- .Throws(new InvalidOperationException());
-
-
- Type of the value.
-
-
-
- Matches any value of the given type.
-
-
- Typically used when the actual argument value for a method
- call is not relevant.
-
-
-
- // Throws an exception for a call to Remove with any string value.
- mock.Protected()
- .Setup("Remove", ItExpr.IsAny<string>())
- .Throws(new InvalidOperationException());
-
-
- Type of the value.
-
-
-
- Matches any value that satisfies the given predicate.
-
- Type of the argument to check.
- The predicate used to match the method argument.
-
- Allows the specification of a predicate to perform matching
- of method call arguments.
-
-
- This example shows how to return the value 1 whenever the argument to the
- Do method is an even number.
-
- mock.Protected()
- .Setup("Do", ItExpr.Is<int>(i => i % 2 == 0))
- .Returns(1);
-
- This example shows how to throw an exception if the argument to the
- method is a negative number:
-
- mock.Protected()
- .Setup("GetUser", ItExpr.Is<int>(i => i < 0))
- .Throws(new ArgumentException());
-
-
-
-
-
- Matches any value that is in the range specified.
-
- Type of the argument to check.
- The lower bound of the range.
- The upper bound of the range.
- The kind of range. See .
-
- The following example shows how to expect a method call
- with an integer argument within the 0..100 range.
-
- mock.Protected()
- .Setup("HasInventory",
- ItExpr.IsAny<string>(),
- ItExpr.IsInRange(0, 100, Range.Inclusive))
- .Returns(false);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
-
- The pattern to use to match the string argument value.
-
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression:
-
- mock.Protected()
- .Setup("Check", ItExpr.IsRegex("[a-z]+"))
- .Returns(1);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
-
- The pattern to use to match the string argument value.
- The options used to interpret the pattern.
-
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression, in a case insensitive way:
-
- mock.Protected()
- .Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase))
- .Returns(1);
-
-
-
-
-
- Enables the Protected() method on ,
- allowing setups to be set for protected members by using their
- name as a string, rather than strong-typing them which is not possible
- due to their visibility.
-
-
-
-
- Enable protected setups for the mock.
-
- Mocked object type. Typically omitted as it can be inferred from the mock instance.
- The mock to set the protected setups on.
-
-
-
-
-
-
-
-
-
-
-
- A strongly-typed resource class, for looking up localized strings, etc.
-
-
-
-
- Returns the cached ResourceManager instance used by this class.
-
-
-
-
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-
-
-
-
- Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that..
-
-
-
-
- Looks up a localized string similar to Value cannot be an empty string..
-
-
-
-
- Looks up a localized string similar to Can only add interfaces to the mock..
-
-
-
-
- Looks up a localized string similar to Can't set return value for void method {0}..
-
-
-
-
- Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks..
-
-
-
-
- Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type..
-
-
-
-
- Looks up a localized string similar to Could not locate event for attach or detach method {0}..
-
-
-
-
- Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead..
-
-
-
-
- Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. .
-
-
-
-
- Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces.
- Please cast the argument to one of the supported types: {1}.
- Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed..
-
-
-
-
- Looks up a localized string similar to The equals ("==" or "=" in VB) and the conditional 'and' ("&&" or "AndAlso" in VB) operators are the only ones supported in the query specification expression. Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to LINQ method '{0}' not supported..
-
-
-
-
- Looks up a localized string similar to Expression contains a call to a method which is not virtual (overridable in VB) or abstract. Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to Member {0}.{1} does not exist..
-
-
-
-
- Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead:
- mock.Setup(x => x.{1}());
- .
-
-
-
-
- Looks up a localized string similar to {0} invocation failed with mock behavior {1}.
- {2}.
-
-
-
-
- Looks up a localized string similar to Expected only {0} calls to {1}..
-
-
-
-
- Looks up a localized string similar to Expected only one call to {0}..
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at least {2} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at least once, but was never performed: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at most {3} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at most once, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock exactly {2} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock should never have been performed, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock once, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to All invocations on the mock must have a corresponding setup..
-
-
-
-
- Looks up a localized string similar to Object instance was not created by Moq..
-
-
-
-
- Looks up a localized string similar to Out expression must evaluate to a constant value..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not have a getter..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not exist..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} is write-only..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} is read-only..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not have a setter..
-
-
-
-
- Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object..
-
-
-
-
- Looks up a localized string similar to Ref expression must evaluate to a constant value..
-
-
-
-
- Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it..
-
-
-
-
- Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>..
-
-
-
-
- Looks up a localized string similar to Invocation {0} should not have been made..
-
-
-
-
- Looks up a localized string similar to Expression is not a method invocation: {0}.
-
-
-
-
- Looks up a localized string similar to Expression is not a property access: {0}.
-
-
-
-
- Looks up a localized string similar to Expression is not a property setter invocation..
-
-
-
-
- Looks up a localized string similar to Expression references a method that does not belong to the mocked object: {0}.
-
-
-
-
- Looks up a localized string similar to Invalid setup on a non-virtual (overridable in VB) member: {0}.
-
-
-
-
- Looks up a localized string similar to Type {0} does not implement required interface {1}.
-
-
-
-
- Looks up a localized string similar to Type {0} does not from required type {1}.
-
-
-
-
- Looks up a localized string similar to To specify a setup for public property {0}.{1}, use the typed overloads, such as:
- mock.Setup(x => x.{1}).Returns(value);
- mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one
- mock.SetupSet(x => x.{1}).Callback(callbackDelegate);
- .
-
-
-
-
- Looks up a localized string similar to Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}..
-
-
-
-
- Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}..
-
-
-
-
- Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters..
-
-
-
-
- Looks up a localized string similar to Member {0} is not supported for protected mocking..
-
-
-
-
- Looks up a localized string similar to Setter expression can only use static custom matchers..
-
-
-
-
- Looks up a localized string similar to The following setups were not matched:
- {0}.
-
-
-
-
- Looks up a localized string similar to Invalid verify on a non-virtual (overridable in VB) member: {0}.
-
-
-
-
- Kind of range to use in a filter specified through
- .
-
-
-
-
- The range includes the to and
- from values.
-
-
-
-
- The range does not include the to and
- from values.
-
-
-
-
- Helper for sequencing return values in the same method.
-
-
-
-
- Return a sequence of values, once per call.
-
-
-
-
- Defines the number of invocations allowed by a mocked method.
-
-
-
-
- Specifies that a mocked method should be invoked times as minimum.
- The minimun number of times.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked one time as minimum.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked time as maximun.
- The maximun number of times.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked one time as maximun.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked between and
- times.
- The minimun number of times.The maximun number of times.
- The kind of range. See .
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked exactly times.
- The times that a method or property can be called.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should not be invoked.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked exactly one time.
- An object defining the allowed number of invocations.
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- true if the specified is equal to this instance; otherwise, false.
-
-
-
-
- Returns a hash code for this instance.
-
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
-
-
-
-
- Determines whether two specified objects have the same value.
-
- The first .
-
- The second .
-
- true if the value of left is the same as the value of right; otherwise, false.
-
-
-
-
- Determines whether two specified objects have different values.
-
- The first .
-
- The second .
-
- true if the value of left is different from the value of right; otherwise, false.
-
-
-
-
diff --git a/RESW File Code Generator/packages/repositories.config b/RESW File Code Generator/packages/repositories.config
deleted file mode 100644
index 62d64cd..0000000
--- a/RESW File Code Generator/packages/repositories.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/RESW File Code Generator/IntegrationTests.testsettings b/vs2013/IntegrationTests.testsettings
similarity index 100%
rename from RESW File Code Generator/IntegrationTests.testsettings
rename to vs2013/IntegrationTests.testsettings
diff --git a/RESW File Code Generator/RESW File Code Generator.sln b/vs2013/RESW File Code Generator.sln
similarity index 100%
rename from RESW File Code Generator/RESW File Code Generator.sln
rename to vs2013/RESW File Code Generator.sln
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/CSharpCodeGeneratorTests.cs b/vs2013/ReswCodeGen.Tests/CSharpCodeGeneratorTests.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/CSharpCodeGeneratorTests.cs
rename to vs2013/ReswCodeGen.Tests/CSharpCodeGeneratorTests.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/CSharpCodeGeneratorTestsInternal.cs b/vs2013/ReswCodeGen.Tests/CSharpCodeGeneratorTestsInternal.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/CSharpCodeGeneratorTestsInternal.cs
rename to vs2013/ReswCodeGen.Tests/CSharpCodeGeneratorTestsInternal.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/ClassNameExtractorTests.cs b/vs2013/ReswCodeGen.Tests/ClassNameExtractorTests.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/ClassNameExtractorTests.cs
rename to vs2013/ReswCodeGen.Tests/ClassNameExtractorTests.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/CodeGeneratorFactoryTests.cs b/vs2013/ReswCodeGen.Tests/CodeGeneratorFactoryTests.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/CodeGeneratorFactoryTests.cs
rename to vs2013/ReswCodeGen.Tests/CodeGeneratorFactoryTests.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/Properties/AssemblyInfo.cs b/vs2013/ReswCodeGen.Tests/Properties/AssemblyInfo.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/Properties/AssemblyInfo.cs
rename to vs2013/ReswCodeGen.Tests/Properties/AssemblyInfo.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/ResourceParserErrorHandlingTests.cs b/vs2013/ReswCodeGen.Tests/ResourceParserErrorHandlingTests.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/ResourceParserErrorHandlingTests.cs
rename to vs2013/ReswCodeGen.Tests/ResourceParserErrorHandlingTests.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/ResourceParserTests.cs b/vs2013/ReswCodeGen.Tests/ResourceParserTests.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/ResourceParserTests.cs
rename to vs2013/ReswCodeGen.Tests/ResourceParserTests.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/Resources/Resources.resw b/vs2013/ReswCodeGen.Tests/Resources/Resources.resw
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/Resources/Resources.resw
rename to vs2013/ReswCodeGen.Tests/Resources/Resources.resw
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/Resources/ResourcesWithoutComments.resw b/vs2013/ReswCodeGen.Tests/Resources/ResourcesWithoutComments.resw
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/Resources/ResourcesWithoutComments.resw
rename to vs2013/ReswCodeGen.Tests/Resources/ResourcesWithoutComments.resw
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/Resources/ResourcesWithoutValues.resw b/vs2013/ReswCodeGen.Tests/Resources/ResourcesWithoutValues.resw
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/Resources/ResourcesWithoutValues.resw
rename to vs2013/ReswCodeGen.Tests/Resources/ResourcesWithoutValues.resw
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/ReswCodeGen.Tests.csproj b/vs2013/ReswCodeGen.Tests/ReswCodeGen.Tests.csproj
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/ReswCodeGen.Tests.csproj
rename to vs2013/ReswCodeGen.Tests/ReswCodeGen.Tests.csproj
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/StringExtensionTests.cs b/vs2013/ReswCodeGen.Tests/StringExtensionTests.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/StringExtensionTests.cs
rename to vs2013/ReswCodeGen.Tests/StringExtensionTests.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/VisualBasicCodeGeneratorInternalTests.cs b/vs2013/ReswCodeGen.Tests/VisualBasicCodeGeneratorInternalTests.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/VisualBasicCodeGeneratorInternalTests.cs
rename to vs2013/ReswCodeGen.Tests/VisualBasicCodeGeneratorInternalTests.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/VisualBasicCodeGeneratorTests.cs b/vs2013/ReswCodeGen.Tests/VisualBasicCodeGeneratorTests.cs
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/VisualBasicCodeGeneratorTests.cs
rename to vs2013/ReswCodeGen.Tests/VisualBasicCodeGeneratorTests.cs
diff --git a/RESW File Code Generator/ReswCodeGen.Tests/packages.config b/vs2013/ReswCodeGen.Tests/packages.config
similarity index 100%
rename from RESW File Code Generator/ReswCodeGen.Tests/packages.config
rename to vs2013/ReswCodeGen.Tests/packages.config
diff --git a/RESW File Code Generator/UnitTests.testsettings b/vs2013/UnitTests.testsettings
similarity index 100%
rename from RESW File Code Generator/UnitTests.testsettings
rename to vs2013/UnitTests.testsettings
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ClassNameExtractor.cs b/vs2013/VSPackage/CustomTool/ClassNameExtractor.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ClassNameExtractor.cs
rename to vs2013/VSPackage/CustomTool/ClassNameExtractor.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/CodeDomCodeGenerator.cs b/vs2013/VSPackage/CustomTool/CodeDomCodeGenerator.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/CodeDomCodeGenerator.cs
rename to vs2013/VSPackage/CustomTool/CodeDomCodeGenerator.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/CodeGenerator.cs b/vs2013/VSPackage/CustomTool/CodeGenerator.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/CodeGenerator.cs
rename to vs2013/VSPackage/CustomTool/CodeGenerator.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/CodeGeneratorFactory.cs b/vs2013/VSPackage/CustomTool/CodeGeneratorFactory.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/CodeGeneratorFactory.cs
rename to vs2013/VSPackage/CustomTool/CodeGeneratorFactory.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ICodeGenerator.cs b/vs2013/VSPackage/CustomTool/ICodeGenerator.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ICodeGenerator.cs
rename to vs2013/VSPackage/CustomTool/ICodeGenerator.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/IResourceParser.cs b/vs2013/VSPackage/CustomTool/IResourceParser.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/IResourceParser.cs
rename to vs2013/VSPackage/CustomTool/IResourceParser.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ResourceItem.cs b/vs2013/VSPackage/CustomTool/ResourceItem.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ResourceItem.cs
rename to vs2013/VSPackage/CustomTool/ResourceItem.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ResourceParser.cs b/vs2013/VSPackage/CustomTool/ResourceParser.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ResourceParser.cs
rename to vs2013/VSPackage/CustomTool/ResourceParser.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ReswFileCSharpCodeGenerator.cs b/vs2013/VSPackage/CustomTool/ReswFileCSharpCodeGenerator.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ReswFileCSharpCodeGenerator.cs
rename to vs2013/VSPackage/CustomTool/ReswFileCSharpCodeGenerator.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ReswFileCSharpCodeGeneratorInternal.cs b/vs2013/VSPackage/CustomTool/ReswFileCSharpCodeGeneratorInternal.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ReswFileCSharpCodeGeneratorInternal.cs
rename to vs2013/VSPackage/CustomTool/ReswFileCSharpCodeGeneratorInternal.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ReswFileCodeGenerator.cs b/vs2013/VSPackage/CustomTool/ReswFileCodeGenerator.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ReswFileCodeGenerator.cs
rename to vs2013/VSPackage/CustomTool/ReswFileCodeGenerator.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ReswFileVisualBasicCodeGenerator.cs b/vs2013/VSPackage/CustomTool/ReswFileVisualBasicCodeGenerator.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ReswFileVisualBasicCodeGenerator.cs
rename to vs2013/VSPackage/CustomTool/ReswFileVisualBasicCodeGenerator.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/ReswFileVisualBasicCodeGeneratorInternal.cs b/vs2013/VSPackage/CustomTool/ReswFileVisualBasicCodeGeneratorInternal.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/ReswFileVisualBasicCodeGeneratorInternal.cs
rename to vs2013/VSPackage/CustomTool/ReswFileVisualBasicCodeGeneratorInternal.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/StringExtension.cs b/vs2013/VSPackage/CustomTool/StringExtension.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/StringExtension.cs
rename to vs2013/VSPackage/CustomTool/StringExtension.cs
diff --git a/RESW File Code Generator/VSPackage/CustomTool/VisualStudioVersion.cs b/vs2013/VSPackage/CustomTool/VisualStudioVersion.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/CustomTool/VisualStudioVersion.cs
rename to vs2013/VSPackage/CustomTool/VisualStudioVersion.cs
diff --git a/RESW File Code Generator/VSPackage/GlobalSuppressions.cs b/vs2013/VSPackage/GlobalSuppressions.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/GlobalSuppressions.cs
rename to vs2013/VSPackage/GlobalSuppressions.cs
diff --git a/RESW File Code Generator/VSPackage/Guids.cs b/vs2013/VSPackage/Guids.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/Guids.cs
rename to vs2013/VSPackage/Guids.cs
diff --git a/RESW File Code Generator/VSPackage/Key.snk b/vs2013/VSPackage/Key.snk
similarity index 100%
rename from RESW File Code Generator/VSPackage/Key.snk
rename to vs2013/VSPackage/Key.snk
diff --git a/RESW File Code Generator/VSPackage/License.txt b/vs2013/VSPackage/License.txt
similarity index 100%
rename from RESW File Code Generator/VSPackage/License.txt
rename to vs2013/VSPackage/License.txt
diff --git a/RESW File Code Generator/VSPackage/Properties/AssemblyInfo.cs b/vs2013/VSPackage/Properties/AssemblyInfo.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/Properties/AssemblyInfo.cs
rename to vs2013/VSPackage/Properties/AssemblyInfo.cs
diff --git a/RESW File Code Generator/VSPackage/Resources.Designer.cs b/vs2013/VSPackage/Resources.Designer.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/Resources.Designer.cs
rename to vs2013/VSPackage/Resources.Designer.cs
diff --git a/RESW File Code Generator/VSPackage/Resources.resx b/vs2013/VSPackage/Resources.resx
similarity index 100%
rename from RESW File Code Generator/VSPackage/Resources.resx
rename to vs2013/VSPackage/Resources.resx
diff --git a/RESW File Code Generator/VSPackage/Resources/Package.ico b/vs2013/VSPackage/Resources/Package.ico
similarity index 100%
rename from RESW File Code Generator/VSPackage/Resources/Package.ico
rename to vs2013/VSPackage/Resources/Package.ico
diff --git a/RESW File Code Generator/VSPackage/VSPackage.csproj b/vs2013/VSPackage/VSPackage.csproj
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage.csproj
rename to vs2013/VSPackage/VSPackage.csproj
diff --git a/RESW File Code Generator/VSPackage/VSPackage.resx b/vs2013/VSPackage/VSPackage.resx
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage.resx
rename to vs2013/VSPackage/VSPackage.resx
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/DialogboxPurger.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/DialogboxPurger.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/DialogboxPurger.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/DialogboxPurger.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/NativeMethods.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/NativeMethods.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/NativeMethods.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/NativeMethods.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/Utils.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/Utils.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/Utils.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/IntegrationTest Library/Utils.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/Key.snk b/vs2013/VSPackage/VSPackage_IntegrationTests/Key.snk
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/Key.snk
rename to vs2013/VSPackage/VSPackage_IntegrationTests/Key.snk
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/PackageTest.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/PackageTest.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/PackageTest.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/PackageTest.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CPPProjectTests.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CPPProjectTests.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CPPProjectTests.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CPPProjectTests.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CSharpProjectTests.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CSharpProjectTests.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CSharpProjectTests.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/CSharpProjectTests.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/SolutionTests.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/SolutionTests.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/SolutionTests.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/SolutionTests.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/VBProjectTests.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/VBProjectTests.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/VBProjectTests.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/SignOff-Tests/VBProjectTests.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/VSPackage_IntegrationTests.csproj b/vs2013/VSPackage/VSPackage_IntegrationTests/VSPackage_IntegrationTests.csproj
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/VSPackage_IntegrationTests.csproj
rename to vs2013/VSPackage/VSPackage_IntegrationTests/VSPackage_IntegrationTests.csproj
diff --git a/RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/VisualStudioVersionHelperTests.cs b/vs2013/VSPackage/VSPackage_IntegrationTests/VisualStudioVersionHelperTests.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_IntegrationTests/VisualStudioVersionHelperTests.cs
rename to vs2013/VSPackage/VSPackage_IntegrationTests/VisualStudioVersionHelperTests.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_UnitTests/Key.snk b/vs2013/VSPackage/VSPackage_UnitTests/Key.snk
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_UnitTests/Key.snk
rename to vs2013/VSPackage/VSPackage_UnitTests/Key.snk
diff --git a/RESW File Code Generator/VSPackage/VSPackage_UnitTests/PackageTest.cs b/vs2013/VSPackage/VSPackage_UnitTests/PackageTest.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_UnitTests/PackageTest.cs
rename to vs2013/VSPackage/VSPackage_UnitTests/PackageTest.cs
diff --git a/RESW File Code Generator/VSPackage/VSPackage_UnitTests/VSPackage_UnitTests.csproj b/vs2013/VSPackage/VSPackage_UnitTests/VSPackage_UnitTests.csproj
similarity index 100%
rename from RESW File Code Generator/VSPackage/VSPackage_UnitTests/VSPackage_UnitTests.csproj
rename to vs2013/VSPackage/VSPackage_UnitTests/VSPackage_UnitTests.csproj
diff --git a/RESW File Code Generator/VSPackage/VisualStudio2012Package.cs b/vs2013/VSPackage/VisualStudio2012Package.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VisualStudio2012Package.cs
rename to vs2013/VSPackage/VisualStudio2012Package.cs
diff --git a/RESW File Code Generator/VSPackage/VisualStudio2013Package.cs b/vs2013/VSPackage/VisualStudio2013Package.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VisualStudio2013Package.cs
rename to vs2013/VSPackage/VisualStudio2013Package.cs
diff --git a/RESW File Code Generator/VSPackage/VisualStudio2015Package.cs b/vs2013/VSPackage/VisualStudio2015Package.cs
similarity index 100%
rename from RESW File Code Generator/VSPackage/VisualStudio2015Package.cs
rename to vs2013/VSPackage/VisualStudio2015Package.cs
diff --git a/RESW File Code Generator/VSPackage/source.extension.vsixmanifest b/vs2013/VSPackage/source.extension.vsixmanifest
similarity index 100%
rename from RESW File Code Generator/VSPackage/source.extension.vsixmanifest
rename to vs2013/VSPackage/source.extension.vsixmanifest
diff --git a/vs2017/ReswCodeGen.sln b/vs2017/ReswCodeGen.sln
new file mode 100644
index 0000000..ab402ca
--- /dev/null
+++ b/vs2017/ReswCodeGen.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.27004.2006
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage", "VSPackage\VSPackage.csproj", "{05F77BFB-CE11-4948-8174-F938C5B7F31C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSPackage.Tests", "VSPackage.Tests\VSPackage.Tests.csproj", "{F2B82735-4AE9-4365-8C0D-8391564359AB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {05F77BFB-CE11-4948-8174-F938C5B7F31C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {05F77BFB-CE11-4948-8174-F938C5B7F31C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {05F77BFB-CE11-4948-8174-F938C5B7F31C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {05F77BFB-CE11-4948-8174-F938C5B7F31C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F2B82735-4AE9-4365-8C0D-8391564359AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F2B82735-4AE9-4365-8C0D-8391564359AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F2B82735-4AE9-4365-8C0D-8391564359AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F2B82735-4AE9-4365-8C0D-8391564359AB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {FEC256E9-B961-4967-9948-F508DA7BF817}
+ EndGlobalSection
+EndGlobal
diff --git a/vs2017/VSPackage.Tests/CSharpCodeGeneratorTests.cs b/vs2017/VSPackage.Tests/CSharpCodeGeneratorTests.cs
new file mode 100644
index 0000000..406bd58
--- /dev/null
+++ b/vs2017/VSPackage.Tests/CSharpCodeGeneratorTests.cs
@@ -0,0 +1,74 @@
+using System.IO;
+using System.Linq;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/Resources.resw")]
+ public class CSharpCodeGeneratorTests
+ {
+ private string reswFileContents;
+ private const string FILE_PATH = "Resources.resw";
+ private string actual;
+ private ICodeGenerator target;
+
+ [TestInitialize]
+ public void Initialize()
+ {
+ reswFileContents = File.ReadAllText(FILE_PATH);
+
+ target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents);
+ actual = target.GenerateCode();
+ }
+
+ [TestMethod]
+ public void GenerateCodeDoesNotReturnNull()
+ {
+ Assert.IsNotNull(actual);
+ }
+
+ [TestMethod]
+ public void GeneratedCodeIsAPublicClass()
+ {
+ Assert.IsTrue(actual.Contains("public sealed partial class"));
+ }
+
+ [TestMethod]
+ public void GeneratedCodeContainsPropertiesDefinedInResources()
+ {
+ var resourceItems = target.ResourceParser.Parse();
+
+ foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
+ Assert.IsTrue(actual.Contains("public static string " + item.Name));
+ }
+
+ [TestMethod]
+ public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources()
+ {
+ var resourceItems = target.ResourceParser.Parse();
+
+ foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
+ Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\""));
+ }
+
+ [TestMethod]
+ public void ClassNameEqualsFileNameWithoutExtension()
+ {
+ Assert.IsTrue(actual.Contains("class Resources"));
+ }
+
+ [TestMethod]
+ public void ResourceLoaderInitializedWithClassName()
+ {
+ Assert.IsTrue(actual.Contains("new ResourceLoader(currentAssemblyName + \"/Resources\");"));
+ }
+
+ [TestMethod]
+ public void ContainsProjectUrl()
+ {
+ Assert.IsTrue(actual.Contains("http://bit.ly/reswcodegen"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/CSharpCodeGeneratorTestsInternal.cs b/vs2017/VSPackage.Tests/CSharpCodeGeneratorTestsInternal.cs
new file mode 100644
index 0000000..84c7e4d
--- /dev/null
+++ b/vs2017/VSPackage.Tests/CSharpCodeGeneratorTestsInternal.cs
@@ -0,0 +1,75 @@
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/Resources.resw")]
+ public class CSharpCodeGeneratorTestsInternal
+ {
+ private string reswFileContents;
+ private const string FILE_PATH = "Resources.resw";
+ private string actual;
+ private ICodeGenerator target;
+
+ [TestInitialize]
+ public void Initialize()
+ {
+ reswFileContents = File.ReadAllText(FILE_PATH);
+
+ target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents, classAccessibility: TypeAttributes.NestedAssembly);
+ actual = target.GenerateCode();
+ }
+
+ [TestMethod]
+ public void GenerateCodeDoesNotReturnNull()
+ {
+ Assert.IsNotNull(actual);
+ }
+
+ [TestMethod]
+ public void GeneratedCodeIsAnInternalClass()
+ {
+ Assert.IsTrue(actual.Contains("internal sealed partial class"));
+ }
+
+ [TestMethod]
+ public void GeneratedCodeContainsPropertiesDefinedInResources()
+ {
+ var resourceItems = target.ResourceParser.Parse();
+
+ foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
+ Assert.IsTrue(actual.Contains("public static string " + item.Name));
+ }
+
+ [TestMethod]
+ public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources()
+ {
+ var resourceItems = target.ResourceParser.Parse();
+
+ foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
+ Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\""));
+ }
+
+ [TestMethod]
+ public void ClassNameEqualsFileNameWithoutExtension()
+ {
+ Assert.IsTrue(actual.Contains("class Resources"));
+ }
+
+ [TestMethod]
+ public void ResourceLoaderInitializedWithClassName()
+ {
+ Assert.IsTrue(actual.Contains("new ResourceLoader(currentAssemblyName + \"/Resources\");"));
+ }
+
+ [TestMethod]
+ public void ContainsProjectUrl()
+ {
+ Assert.IsTrue(actual.Contains("http://bit.ly/reswcodegen"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/ClassNameExtractorTests.cs b/vs2017/VSPackage.Tests/ClassNameExtractorTests.cs
new file mode 100644
index 0000000..d48fec5
--- /dev/null
+++ b/vs2017/VSPackage.Tests/ClassNameExtractorTests.cs
@@ -0,0 +1,34 @@
+using System.IO;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/Resources.resw")]
+ public class ClassNameExtractorTests
+ {
+ private const string ClassName = "Resources.resw";
+
+ [TestMethod]
+ public void DoesNotReturnNull()
+ {
+ var actual = ClassNameExtractor.GetClassName(ClassName);
+ Assert.IsNotNull(actual);
+ }
+
+ [TestMethod]
+ public void ReturnsFileNameWithoutExtension()
+ {
+ var actual = ClassNameExtractor.GetClassName(ClassName);
+ Assert.AreEqual("Resources", actual);
+ }
+
+ [TestMethod]
+ [ExpectedException(typeof(FileNotFoundException))]
+ public void ThrowsFileNotFoundException()
+ {
+ ClassNameExtractor.GetClassName("C:\\Test\\Resources\\Strings.resw");
+ }
+ }
+}
diff --git a/vs2017/VSPackage.Tests/CodeGeneratorFactoryTests.cs b/vs2017/VSPackage.Tests/CodeGeneratorFactoryTests.cs
new file mode 100644
index 0000000..e02fbb3
--- /dev/null
+++ b/vs2017/VSPackage.Tests/CodeGeneratorFactoryTests.cs
@@ -0,0 +1,28 @@
+using System.IO;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/Valid/Resources.resw")]
+ public class CodeGeneratorFactoryTests
+ {
+ private string reswFileContents;
+ private const string CLASS_NAME = "C:\\Test\\Resources\\Strings.resw";
+
+ [TestInitialize]
+ public void Initialize()
+ {
+ reswFileContents = File.ReadAllText("Resources.resw");
+ }
+
+ [TestMethod]
+ public void CodeGeneratorFactoryReturnsValidInstance()
+ {
+ var target = new CodeGeneratorFactory();
+ var actual = target.Create(CLASS_NAME, "TestApp", reswFileContents);
+ Assert.IsNotNull(actual);
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/Properties/AssemblyInfo.cs b/vs2017/VSPackage.Tests/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..9fc91ab
--- /dev/null
+++ b/vs2017/VSPackage.Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("VSPackage.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("VSPackage.Tests")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("f2b82735-4ae9-4365-8c0d-8391564359ab")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/vs2017/VSPackage.Tests/ResourceParserErrorHandlingTests.cs b/vs2017/VSPackage.Tests/ResourceParserErrorHandlingTests.cs
new file mode 100644
index 0000000..7a28f9a
--- /dev/null
+++ b/vs2017/VSPackage.Tests/ResourceParserErrorHandlingTests.cs
@@ -0,0 +1,62 @@
+using System.IO;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/ResourcesWithoutValues.resw")]
+ [DeploymentItem("Resources/ResourcesWithoutComments.resw")]
+ public class ResourceParserErrorHandlingTests
+ {
+ [TestMethod]
+ public void ParseHandlesMissingResourceItemValues()
+ {
+ var reswFileContents = File.ReadAllText("ResourcesWithoutValues.resw");
+ var target = new ResourceParser(reswFileContents);
+ var actual = target.Parse();
+
+ Assert.IsNotNull(actual);
+ CollectionAssert.AllItemsAreNotNull(actual);
+ }
+
+ [TestMethod]
+ public void ParseWithMissingResourceItemValuesSetsValueNull()
+ {
+ var reswFileContents = File.ReadAllText("ResourcesWithoutValues.resw");
+ var target = new ResourceParser(reswFileContents);
+ var actual = target.Parse();
+
+ Assert.IsNotNull(actual);
+ CollectionAssert.AllItemsAreNotNull(actual);
+
+ foreach (var item in actual)
+ Assert.IsTrue(string.IsNullOrEmpty(item.Value));
+ }
+
+ [TestMethod]
+ public void ParseHandlesMissingResourceItemComments()
+ {
+ var reswFileContents = File.ReadAllText("ResourcesWithoutComments.resw");
+ var target = new ResourceParser(reswFileContents);
+ var actual = target.Parse();
+
+ Assert.IsNotNull(actual);
+ CollectionAssert.AllItemsAreNotNull(actual);
+ }
+
+ [TestMethod]
+ public void ParseWithMissingResourceItemCommentsSetsCommentsNull()
+ {
+ var reswFileContents = File.ReadAllText("ResourcesWithoutComments.resw");
+ var target = new ResourceParser(reswFileContents);
+ var actual = target.Parse();
+
+ Assert.IsNotNull(actual);
+ CollectionAssert.AllItemsAreNotNull(actual);
+
+ foreach (var item in actual)
+ Assert.IsTrue(string.IsNullOrEmpty(item.Comment));
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/ResourceParserTests.cs b/vs2017/VSPackage.Tests/ResourceParserTests.cs
new file mode 100644
index 0000000..0eebe27
--- /dev/null
+++ b/vs2017/VSPackage.Tests/ResourceParserTests.cs
@@ -0,0 +1,88 @@
+using System.IO;
+using System.Linq;
+using System.Xml.Linq;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/Resources.resw")]
+ public class ResourceParserTests
+ {
+ private string reswFileContents;
+
+ [TestInitialize]
+ public void Initialize()
+ {
+ reswFileContents = File.ReadAllText("Resources.resw");
+ }
+
+ [TestMethod]
+ public void CanLoadTestReswFileContents()
+ {
+ Assert.IsNotNull(reswFileContents);
+ }
+
+ [TestMethod]
+ public void CanTestReswFileContentsLoadToXDocument()
+ {
+ var doc = XDocument.Parse(reswFileContents);
+ Assert.IsNotNull(doc);
+ }
+
+ [TestMethod]
+ public void CanParseTestReswFileContents()
+ {
+ var doc = XDocument.Parse(reswFileContents);
+ var resourcs = doc.Descendants("data");
+ Assert.IsNotNull(resourcs);
+ Assert.AreNotEqual(0, resourcs.Count());
+ }
+
+ [TestMethod]
+ public void ConstructorSetsReswFileContents()
+ {
+ var target = new ResourceParser(reswFileContents);
+ Assert.IsNotNull(target.ReswFileContents);
+ }
+
+ [TestMethod]
+ public void ParseReturnsResourceItems()
+ {
+ var target = new ResourceParser(reswFileContents);
+ var actual = target.Parse();
+ Assert.IsNotNull(actual);
+ }
+
+ [TestMethod]
+ public void ParseReturnedResourceItemsContainsName()
+ {
+ var target = new ResourceParser(reswFileContents);
+ var actual = target.Parse();
+
+ foreach (var item in actual)
+ Assert.IsNotNull(item.Name);
+ }
+
+ [TestMethod]
+ public void ParseReturnedResourceItemsContainsValue()
+ {
+ var target = new ResourceParser(reswFileContents);
+ var actual = target.Parse();
+
+ foreach (var item in actual)
+ Assert.IsNotNull(item.Value);
+ }
+
+ [TestMethod]
+ public void ParseReturnedResourceItemsContainsComment()
+ {
+ var target = new ResourceParser(reswFileContents);
+ var actual = target.Parse();
+
+ foreach (var item in actual)
+ Assert.IsNotNull(item.Comment);
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/Resources/Resources.resw b/vs2017/VSPackage.Tests/Resources/Resources.resw
new file mode 100644
index 0000000..7f241aa
--- /dev/null
+++ b/vs2017/VSPackage.Tests/Resources/Resources.resw
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Test 1 value
+ Test 1 comment
+
+
+ Test 2 value
+ Test 2 comment
+
+
+ Test 3 value
+ Test 3 comment
+
+
+ TestControl.Text value
+ TestControl.Test comment
+
+
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/Resources/ResourcesWithoutComments.resw b/vs2017/VSPackage.Tests/Resources/ResourcesWithoutComments.resw
new file mode 100644
index 0000000..1067626
--- /dev/null
+++ b/vs2017/VSPackage.Tests/Resources/ResourcesWithoutComments.resw
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Test 1 value
+
+
+ Test 2 value
+
+
+ Test 3 value
+
+
+ TestControl.Text value
+
+
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/Resources/ResourcesWithoutValues.resw b/vs2017/VSPackage.Tests/Resources/ResourcesWithoutValues.resw
new file mode 100644
index 0000000..a6e258c
--- /dev/null
+++ b/vs2017/VSPackage.Tests/Resources/ResourcesWithoutValues.resw
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ Test 1 comment
+
+
+
+ Test 2 comment
+
+
+
+ Test 3 comment
+
+
+
+ TestControl.Test comment
+
+
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/StringExtensionTests.cs b/vs2017/VSPackage.Tests/StringExtensionTests.cs
new file mode 100644
index 0000000..3a878c6
--- /dev/null
+++ b/vs2017/VSPackage.Tests/StringExtensionTests.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Runtime.InteropServices;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/Resources.resw")]
+ public class StringExtensionTests
+ {
+ const string TEXT = "test";
+
+ [TestMethod]
+ public void ConvertToIntPtrDoesNotReturnZero()
+ {
+ uint len;
+ var ptr = TEXT.ConvertToIntPtr(out len);
+ Assert.AreNotEqual(IntPtr.Zero, ptr);
+ }
+
+ [TestMethod]
+ public void ConvertToIntPtrReturnsStringLengthAsParameter()
+ {
+ uint len;
+ TEXT.ConvertToIntPtr(out len);
+ Assert.AreNotEqual(TEXT.Length, len);
+ }
+
+ [TestMethod]
+ public void ConvertToIntPtrConvertsCorrectString()
+ {
+ uint len;
+ var ptr = TEXT.ConvertToIntPtr(out len);
+ var str = Marshal.PtrToStringAnsi(ptr, (int) len);
+ Assert.AreEqual(TEXT, str);
+ }
+ }
+}
diff --git a/vs2017/VSPackage.Tests/VSPackage.Tests.csproj b/vs2017/VSPackage.Tests/VSPackage.Tests.csproj
new file mode 100644
index 0000000..252a614
--- /dev/null
+++ b/vs2017/VSPackage.Tests/VSPackage.Tests.csproj
@@ -0,0 +1,91 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {F2B82735-4AE9-4365-8C0D-8391564359AB}
+ Library
+ Properties
+ ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+ VSPackage.Tests
+ v4.6.1
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 15.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+
+
+ ..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+
+
+ {05f77bfb-ce11-4948-8174-f938c5b7f31c}
+ VSPackage
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/VisualBasicCodeGeneratorInternalTests.cs b/vs2017/VSPackage.Tests/VisualBasicCodeGeneratorInternalTests.cs
new file mode 100644
index 0000000..d76239b
--- /dev/null
+++ b/vs2017/VSPackage.Tests/VisualBasicCodeGeneratorInternalTests.cs
@@ -0,0 +1,76 @@
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualBasic;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/Resources.resw")]
+ public class VisualBasicCodeGeneratorInternalTests
+ {
+ private const string FILE_PATH = "Resources.resw";
+ private string actual;
+ private string reswFileContents;
+ private ICodeGenerator target;
+
+ [TestInitialize]
+ public void Initialize()
+ {
+ reswFileContents = File.ReadAllText(FILE_PATH);
+
+ target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents, new VBCodeProvider(), TypeAttributes.NestedAssembly);
+ actual = target.GenerateCode();
+ }
+
+ [TestMethod]
+ public void GenerateCodeDoesNotReturnNull()
+ {
+ Assert.IsNotNull(actual);
+ }
+
+ [TestMethod]
+ public void GeneratedCodeIsFriendClass()
+ {
+ Assert.IsTrue(actual.Contains("Partial Friend NotInheritable Class"));
+ }
+
+ [TestMethod]
+ public void GeneratedCodeContainsPropertiesDefinedInResources()
+ {
+ var resourceItems = target.ResourceParser.Parse();
+
+ foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
+ Assert.IsTrue(actual.Contains("Public Shared ReadOnly Property " + item.Name + "() As String"));
+ }
+
+ [TestMethod]
+ public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources()
+ {
+ var resourceItems = target.ResourceParser.Parse();
+
+ foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
+ Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\""));
+ }
+
+ [TestMethod]
+ public void ClassNameEqualsFileNameWithoutExtension()
+ {
+ Assert.IsTrue(actual.Contains("Class Resources"));
+ }
+
+ [TestMethod]
+ public void ResourceLoaderInitializedWithClassName()
+ {
+ Assert.IsTrue(actual.Contains("New ResourceLoader(currentAssemblyName + \"/Resources\")"));
+ }
+
+ [TestMethod]
+ public void ContainsProjectUrl()
+ {
+ Assert.IsTrue(actual.Contains("http://bit.ly/reswcodegen"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/VisualBasicCodeGeneratorTests.cs b/vs2017/VSPackage.Tests/VisualBasicCodeGeneratorTests.cs
new file mode 100644
index 0000000..97fdc28
--- /dev/null
+++ b/vs2017/VSPackage.Tests/VisualBasicCodeGeneratorTests.cs
@@ -0,0 +1,69 @@
+using System.IO;
+using System.Linq;
+using ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool;
+using Microsoft.VisualBasic;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.CustomTool.Tests
+{
+ [TestClass]
+ [DeploymentItem("Resources/Resources.resw")]
+ public class VisualBasicCodeGeneratorTests
+ {
+ private const string FILE_PATH = "Resources.resw";
+ private string actual;
+ private string reswFileContents;
+ private ICodeGenerator target;
+
+ [TestInitialize]
+ public void Initialize()
+ {
+ reswFileContents = File.ReadAllText(FILE_PATH);
+
+ target = new CodeGeneratorFactory().Create(FILE_PATH.Replace(".resw", string.Empty), "TestApp", reswFileContents, new VBCodeProvider());
+ actual = target.GenerateCode();
+ }
+
+ [TestMethod]
+ public void GenerateCodeDoesNotReturnNull()
+ {
+ Assert.IsNotNull(actual);
+ }
+
+ [TestMethod]
+ public void GeneratedCodeContainsPropertiesDefinedInResources()
+ {
+ var resourceItems = target.ResourceParser.Parse();
+
+ foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
+ Assert.IsTrue(actual.Contains("Public Shared ReadOnly Property " + item.Name + "() As String"));
+ }
+
+ [TestMethod]
+ public void GeneratedCodePropertiesContainsCommentsSimilarToValuesDefinedInResources()
+ {
+ var resourceItems = target.ResourceParser.Parse();
+
+ foreach (var item in resourceItems.Where(item => !item.Name.Contains(".")))
+ Assert.IsTrue(actual.Contains("Localized resource similar to \"" + item.Value + "\""));
+ }
+
+ [TestMethod]
+ public void ClassNameEqualsFileNameWithoutExtension()
+ {
+ Assert.IsTrue(actual.Contains("Class Resources"));
+ }
+
+ [TestMethod]
+ public void ResourceLoaderInitializedWithClassName()
+ {
+ Assert.IsTrue(actual.Contains("New ResourceLoader(currentAssemblyName + \"/Resources\")"));
+ }
+
+ [TestMethod]
+ public void ContainsProjectUrl()
+ {
+ Assert.IsTrue(actual.Contains("http://bit.ly/reswcodegen"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage.Tests/packages.config b/vs2017/VSPackage.Tests/packages.config
new file mode 100644
index 0000000..d8c1b90
--- /dev/null
+++ b/vs2017/VSPackage.Tests/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/ClassNameExtractor.cs b/vs2017/VSPackage/CustomTool/ClassNameExtractor.cs
new file mode 100644
index 0000000..650bbf6
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ClassNameExtractor.cs
@@ -0,0 +1,16 @@
+using System.IO;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public static class ClassNameExtractor
+ {
+ public static string GetClassName(string wszInputFilePath)
+ {
+ if (!File.Exists(wszInputFilePath))
+ throw new FileNotFoundException();
+
+ var fileInfo = new FileInfo(wszInputFilePath);
+ return fileInfo.Name.Replace(fileInfo.Extension, string.Empty);
+ }
+ }
+}
diff --git a/vs2017/VSPackage/CustomTool/CodeDomCodeGenerator.cs b/vs2017/VSPackage/CustomTool/CodeDomCodeGenerator.cs
new file mode 100644
index 0000000..fd9c02a
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/CodeDomCodeGenerator.cs
@@ -0,0 +1,207 @@
+using System;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using Microsoft.CSharp;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public class CodeDomCodeGenerator : CodeGenerator, IDisposable
+ {
+ private readonly TypeAttributes? classAccessibility;
+ private readonly VisualStudioVersion visualStudioVersion;
+ private readonly string className;
+ private readonly CodeNamespace codeNamespace;
+ private readonly CodeCompileUnit compileUnit;
+ private readonly CodeDomProvider provider;
+
+ public CodeDomCodeGenerator(IResourceParser resourceParser,
+ string className,
+ string defaultNamespace,
+ CodeDomProvider codeDomProvider = null,
+ TypeAttributes? classAccessibility = null,
+ VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2012)
+ : base(resourceParser, defaultNamespace)
+ {
+ this.className = className;
+ this.classAccessibility = classAccessibility;
+ this.visualStudioVersion = visualStudioVersion;
+ compileUnit = new CodeCompileUnit();
+ provider = codeDomProvider ?? new CSharpCodeProvider();
+ codeNamespace = new CodeNamespace(defaultNamespace);
+ }
+
+ public override string GenerateCode()
+ {
+ codeNamespace.Comments.Add(
+ new CodeCommentStatement("--------------------------------------------------------------------------------------------------"));
+ codeNamespace.Comments.Add(new CodeCommentStatement(""));
+ codeNamespace.Comments.Add(new CodeCommentStatement("\tThis code was generated by ResW File Code Generator (http://bit.ly/reswcodegen)"));
+ codeNamespace.Comments.Add(new CodeCommentStatement("\tResW File Code Generator was written by Christian Resma Helle"));
+ codeNamespace.Comments.Add(new CodeCommentStatement("\tand is under GNU General Public License version 2 (GPLv2)"));
+ codeNamespace.Comments.Add(new CodeCommentStatement(string.Empty));
+ codeNamespace.Comments.Add(new CodeCommentStatement("\tThis code contains a helper class exposing property representations"));
+ codeNamespace.Comments.Add(new CodeCommentStatement("\tof the string resources defined in the specified .ResW file"));
+ codeNamespace.Comments.Add(new CodeCommentStatement(string.Empty));
+ codeNamespace.Comments.Add(new CodeCommentStatement("\tGenerated: " + DateTime.Now.ToString(CultureInfo.InvariantCulture)));
+ codeNamespace.Comments.Add(new CodeCommentStatement(""));
+ codeNamespace.Comments.Add(
+ new CodeCommentStatement("--------------------------------------------------------------------------------------------------"));
+
+ codeNamespace.Imports.Add(new CodeNamespaceImport("Windows.ApplicationModel.Resources"));
+
+ var targetClass = new CodeTypeDeclaration(className)
+ {
+ IsClass = true,
+ IsPartial = true,
+ TypeAttributes = TypeAttributes.Sealed | (classAccessibility ?? TypeAttributes.Public),
+ Attributes = MemberAttributes.Public | MemberAttributes.Static | MemberAttributes.Final
+ };
+
+ const string resourceLoaderType = "ResourceLoader";
+ var resourceLoaderField = new CodeMemberField(resourceLoaderType, "resourceLoader")
+ {
+ Attributes = MemberAttributes.Private | MemberAttributes.Static | MemberAttributes.Final
+ };
+ targetClass.Members.Add(resourceLoaderField);
+
+ var constructor = new CodeTypeConstructor();
+
+ var executingAssemblyVar = new CodeVariableDeclarationStatement(typeof (string), "executingAssemblyName");
+ var executingAssemblyInit = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblyName"),
+ new CodeSnippetExpression("Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName"));
+ var executingAssemblySplit = new CodeVariableDeclarationStatement(typeof (string[]), "executingAssemblySplit");
+ var executingAssemblyInit2 = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblySplit"),
+ new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("executingAssemblyName"),
+ "Split",
+ new CodePrimitiveExpression(',')));
+ var executingAssemblyInit3 = new CodeAssignStatement(new CodeVariableReferenceExpression("executingAssemblyName"),
+ new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("executingAssemblySplit"),
+ new CodePrimitiveExpression(1)));
+
+ var currentAssemblyVar = new CodeVariableDeclarationStatement(typeof (string), "currentAssemblyName");
+ var currentAssemblyInit = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblyName"),
+ new CodePropertyReferenceExpression(new CodeTypeOfExpression(className), "AssemblyQualifiedName"));
+ var currentAssemblySplit = new CodeVariableDeclarationStatement(typeof (string[]), "currentAssemblySplit");
+ var currentAssemblyInit2 = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblySplit"),
+ new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("currentAssemblyName"),
+ "Split",
+ new CodePrimitiveExpression(',')));
+ var currentAssemblyInit3 = new CodeAssignStatement(new CodeVariableReferenceExpression("currentAssemblyName"),
+ new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("currentAssemblySplit"),
+ new CodePrimitiveExpression(1)));
+
+ var createResourceLoader = new CodeConditionStatement(
+ new CodeSnippetExpression("executingAssemblyName.Equals(currentAssemblyName)"),
+ new CodeStatement[] // true
+ {
+ visualStudioVersion == VisualStudioVersion.VS2013
+ ? new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
+ new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResourceLoader"),
+ "GetForCurrentView",
+ new CodeSnippetExpression("\"" + className + "\"")))
+ : new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
+ new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
+ new CodeSnippetExpression("\"" + className + "\"")))
+ },
+ new CodeStatement[] // false
+ {
+ visualStudioVersion == VisualStudioVersion.VS2013
+ ? new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
+ new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResourceLoader"),
+ "GetForCurrentView",
+ new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
+ : new CodeAssignStatement(new CodeFieldReferenceExpression(null, "resourceLoader"),
+ new CodeObjectCreateExpression(new CodeTypeReference("ResourceLoader"),
+ new CodeSnippetExpression("currentAssemblyName + \"/" + className + "\"")))
+ });
+
+ constructor.Statements.Add(executingAssemblyVar);
+ constructor.Statements.Add(executingAssemblyInit);
+ constructor.Statements.Add(executingAssemblySplit);
+ constructor.Statements.Add(executingAssemblyInit2);
+ constructor.Statements.Add(executingAssemblyInit3);
+ constructor.Statements.Add(currentAssemblyVar);
+ constructor.Statements.Add(currentAssemblyInit);
+ constructor.Statements.Add(currentAssemblySplit);
+ constructor.Statements.Add(currentAssemblyInit2);
+ constructor.Statements.Add(currentAssemblyInit3);
+ constructor.Statements.Add(createResourceLoader);
+
+ targetClass.Members.Add(constructor);
+
+ var resources = ResourceParser.Parse();
+ foreach (var item in resources)
+ {
+ if (string.IsNullOrEmpty(item.Name) || item.Name.Contains("."))
+ continue;
+
+ var property = new CodeMemberProperty
+ {
+ Name = item.Name.Trim(),
+ Attributes = MemberAttributes.Public | MemberAttributes.Static,
+ HasGet = true,
+ Type = new CodeTypeReference(typeof (string))
+ };
+
+ property.Comments.Add(new CodeCommentStatement("", true));
+ property.Comments.Add(new CodeCommentStatement("Localized resource similar to \"" + (item.Value ?? item.Name) + "\"", true));
+ property.Comments.Add(new CodeCommentStatement("", true));
+ property.GetStatements.Add(
+ new CodeMethodReturnStatement(
+ new CodeMethodInvokeExpression(
+ new CodeFieldReferenceExpression(null, "resourceLoader"),
+ "GetString",
+ new CodePrimitiveExpression(item.Name))));
+
+ targetClass.Members.Add(property);
+ }
+
+ codeNamespace.Types.Add(targetClass);
+ compileUnit.Namespaces.Add(codeNamespace);
+
+ return GenerateCodeFromCompileUnit();
+ }
+
+ private string GenerateCodeFromCompileUnit()
+ {
+ var options = new CodeGeneratorOptions {BracingStyle = "C"};
+
+ var code = new StringBuilder();
+
+ using (var writer = new StringWriter(code))
+ provider.GenerateCodeFromCompileUnit(compileUnit, writer, options);
+
+ return code.ToString();
+ }
+
+ #region IDisposable
+
+ private bool disposed;
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ ~CodeDomCodeGenerator()
+ {
+ Dispose(false);
+ }
+
+ protected virtual void Dispose(bool dispose)
+ {
+ if (disposed)
+ return;
+ disposed = true;
+
+ if (dispose)
+ provider.Dispose();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/CodeGenerator.cs b/vs2017/VSPackage/CustomTool/CodeGenerator.cs
new file mode 100644
index 0000000..3edb823
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/CodeGenerator.cs
@@ -0,0 +1,16 @@
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public abstract class CodeGenerator : ICodeGenerator
+ {
+ protected CodeGenerator(IResourceParser resourceParser, string defaultNamespace)
+ {
+ ResourceParser = resourceParser;
+ Namespace = defaultNamespace;
+ }
+
+ public IResourceParser ResourceParser { get; set; }
+ public string Namespace { get; set; }
+
+ public abstract string GenerateCode();
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/CodeGeneratorFactory.cs b/vs2017/VSPackage/CustomTool/CodeGeneratorFactory.cs
new file mode 100644
index 0000000..c533cc1
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/CodeGeneratorFactory.cs
@@ -0,0 +1,33 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Reflection;
+using EnvDTE;
+using Microsoft.VisualStudio.Shell;
+using Microsoft.VisualStudio.Shell.Interop;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public class CodeGeneratorFactory
+ {
+ public ICodeGenerator Create(string className, string defaultNamespace, string inputFileContents, CodeDomProvider codeDomProvider = null, TypeAttributes? classAccessibility = null)
+ {
+ return new CodeDomCodeGenerator(new ResourceParser(inputFileContents), className, defaultNamespace, codeDomProvider, classAccessibility, VisualStudioHelper.GetVersion());
+ }
+ }
+
+ public static class VisualStudioHelper
+ {
+ public static VisualStudioVersion GetVersion()
+ {
+ var dte = Package.GetGlobalService(typeof(SDTE)) as DTE;
+ var vsVersion = VisualStudioVersion.VS2012;
+ if (dte != null)
+ {
+ Version dteVersion;
+ if (Version.TryParse(dte.Version, out dteVersion) && dteVersion >= new Version(12, 0))
+ vsVersion = VisualStudioVersion.VS2013;
+ }
+ return vsVersion;
+ }
+ }
+}
diff --git a/vs2017/VSPackage/CustomTool/ICodeGenerator.cs b/vs2017/VSPackage/CustomTool/ICodeGenerator.cs
new file mode 100644
index 0000000..965b284
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ICodeGenerator.cs
@@ -0,0 +1,9 @@
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public interface ICodeGenerator
+ {
+ IResourceParser ResourceParser { get; set; }
+ string Namespace { get; set; }
+ string GenerateCode();
+ }
+}
diff --git a/vs2017/VSPackage/CustomTool/IResourceParser.cs b/vs2017/VSPackage/CustomTool/IResourceParser.cs
new file mode 100644
index 0000000..51629c5
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/IResourceParser.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public interface IResourceParser
+ {
+ string ReswFileContents { get; set; }
+ List Parse();
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/ResourceItem.cs b/vs2017/VSPackage/CustomTool/ResourceItem.cs
new file mode 100644
index 0000000..644ec73
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ResourceItem.cs
@@ -0,0 +1,9 @@
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public class ResourceItem
+ {
+ public string Name { get; set; }
+ public string Value { get; set; }
+ public string Comment { get; set; }
+ }
+}
diff --git a/vs2017/VSPackage/CustomTool/ResourceParser.cs b/vs2017/VSPackage/CustomTool/ResourceParser.cs
new file mode 100644
index 0000000..4425c92
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ResourceParser.cs
@@ -0,0 +1,53 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml.Linq;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public class ResourceParser : IResourceParser
+ {
+ public ResourceParser(string reswFileContents)
+ {
+ ReswFileContents = reswFileContents;
+ }
+
+ public string ReswFileContents { get; set; }
+
+ public List Parse()
+ {
+ var doc = XDocument.Parse(ReswFileContents);
+
+ var list = new List();
+
+ foreach (var element in doc.Descendants("data"))
+ {
+ if (element.Attributes().All(c => c.Name != "name"))
+ continue;
+
+ var item = new ResourceItem();
+
+ var nameAttribute = element.Attribute("name");
+ if (nameAttribute != null)
+ item.Name = nameAttribute.Value;
+
+ if (element.Descendants().Any(c => c.Name == "value"))
+ {
+ var valueElement = element.Descendants("value").FirstOrDefault();
+ if (valueElement != null)
+ item.Value = valueElement.Value;
+ }
+
+ if (element.Descendants().Any(c => c.Name == "comment"))
+ {
+ var commentElement = element.Descendants("comment").FirstOrDefault();
+ if (commentElement != null)
+ item.Comment = commentElement.Value;
+ }
+
+ list.Add(item);
+ }
+
+ return list;
+ }
+ }
+}
diff --git a/vs2017/VSPackage/CustomTool/ReswFileCSharpCodeGenerator.cs b/vs2017/VSPackage/CustomTool/ReswFileCSharpCodeGenerator.cs
new file mode 100644
index 0000000..63550c9
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ReswFileCSharpCodeGenerator.cs
@@ -0,0 +1,28 @@
+using System.Runtime.InteropServices;
+using Microsoft.CSharp;
+using Microsoft.VisualStudio.Shell;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ [Guid("98983F6D-BC77-46AC-BA5A-8D9E8763F0D2")]
+ [ComVisible(true)]
+ [ProvideObject(typeof(ReswFileCSharpCodeGenerator))]
+ [CodeGeneratorRegistration(typeof(ReswFileCSharpCodeGenerator),
+ "C# ResW File Code Generator",
+ Guids.ReswFileCSharpCodeGenerator,
+ GeneratesDesignTimeSource = true,
+ GeneratorRegKeyName = "ReswFileCodeGenerator")]
+ public class ReswFileCSharpCodeGenerator : ReswFileCodeGenerator
+ {
+ public ReswFileCSharpCodeGenerator()
+ : base(new CSharpCodeProvider())
+ {
+ }
+
+ public override int DefaultExtension(out string pbstrDefaultExtension)
+ {
+ pbstrDefaultExtension = ".cs";
+ return 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/ReswFileCSharpCodeGeneratorInternal.cs b/vs2017/VSPackage/CustomTool/ReswFileCSharpCodeGeneratorInternal.cs
new file mode 100644
index 0000000..f6e6624
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ReswFileCSharpCodeGeneratorInternal.cs
@@ -0,0 +1,29 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using Microsoft.CSharp;
+using Microsoft.VisualStudio.Shell;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ [Guid("151F74CA-404D-4188-B994-D7683C32ACF4")]
+ [ComVisible(true)]
+ [ProvideObject(typeof(ReswFileCSharpCodeGeneratorInternal))]
+ [CodeGeneratorRegistration(typeof(ReswFileCSharpCodeGeneratorInternal),
+ "C# ResW File Code Generator (Internal class)",
+ Guids.ReswFileCSharpCodeGenerator,
+ GeneratesDesignTimeSource = true,
+ GeneratorRegKeyName = "InternalReswFileCodeGenerator")]
+ public class ReswFileCSharpCodeGeneratorInternal : ReswFileCodeGenerator
+ {
+ public ReswFileCSharpCodeGeneratorInternal()
+ : base(new CSharpCodeProvider(), TypeAttributes.NestedAssembly)
+ {
+ }
+
+ public override int DefaultExtension(out string pbstrDefaultExtension)
+ {
+ pbstrDefaultExtension = ".cs";
+ return 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/ReswFileCodeGenerator.cs b/vs2017/VSPackage/CustomTool/ReswFileCodeGenerator.cs
new file mode 100644
index 0000000..50be5cf
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ReswFileCodeGenerator.cs
@@ -0,0 +1,55 @@
+using System;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Windows.Forms;
+using Microsoft.VisualStudio.Shell.Interop;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ [ComVisible(true)]
+ public abstract class ReswFileCodeGenerator : IVsSingleFileGenerator
+ {
+ private readonly CodeDomProvider codeDomProvider;
+ private readonly TypeAttributes? classAccessibility;
+
+ protected ReswFileCodeGenerator(CodeDomProvider codeDomProvider, TypeAttributes? classAccessibility = null)
+ {
+ this.codeDomProvider = codeDomProvider;
+ this.classAccessibility = classAccessibility;
+ }
+
+ #region IVsSingleFileGenerator Members
+
+ public abstract int DefaultExtension(out string pbstrDefaultExtension);
+
+ public virtual int Generate(string wszInputFilePath,
+ string bstrInputFileContents,
+ string wszDefaultNamespace,
+ IntPtr[] rgbOutputFileContents,
+ out uint pcbOutput,
+ IVsGeneratorProgress pGenerateProgress)
+ {
+ try
+ {
+ var className = ClassNameExtractor.GetClassName(wszInputFilePath);
+ var factory = new CodeGeneratorFactory();
+ var codeGenerator = factory.Create(className, wszDefaultNamespace, bstrInputFileContents, codeDomProvider, classAccessibility);
+ var code = codeGenerator.GenerateCode();
+
+ rgbOutputFileContents[0] = code.ConvertToIntPtr(out pcbOutput);
+ }
+ catch (Exception e)
+ {
+ MessageBox.Show(e.Message, "Unable to generate code");
+ throw;
+ }
+
+ return 0;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/ReswFileVisualBasicCodeGenerator.cs b/vs2017/VSPackage/CustomTool/ReswFileVisualBasicCodeGenerator.cs
new file mode 100644
index 0000000..374fd65
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ReswFileVisualBasicCodeGenerator.cs
@@ -0,0 +1,28 @@
+using System.Runtime.InteropServices;
+using Microsoft.VisualBasic;
+using Microsoft.VisualStudio.Shell;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ [Guid("92DFB543-7138-419B-99D9-90CC77607671")]
+ [ComVisible(true)]
+ [ProvideObject(typeof(ReswFileVisualBasicCodeGenerator))]
+ [CodeGeneratorRegistration(typeof(ReswFileVisualBasicCodeGenerator),
+ "Visual Basic ResW File Code Generator",
+ Guids.ReswFileVisualBasicCodeGenerator,
+ GeneratesDesignTimeSource = true,
+ GeneratorRegKeyName = "ReswFileCodeGenerator")]
+ public class ReswFileVisualBasicCodeGenerator : ReswFileCodeGenerator
+ {
+ public ReswFileVisualBasicCodeGenerator()
+ : base(new VBCodeProvider())
+ {
+ }
+
+ public override int DefaultExtension(out string pbstrDefaultExtension)
+ {
+ pbstrDefaultExtension = ".vb";
+ return 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/ReswFileVisualBasicCodeGeneratorInternal.cs b/vs2017/VSPackage/CustomTool/ReswFileVisualBasicCodeGeneratorInternal.cs
new file mode 100644
index 0000000..db9390b
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/ReswFileVisualBasicCodeGeneratorInternal.cs
@@ -0,0 +1,29 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using Microsoft.VisualBasic;
+using Microsoft.VisualStudio.Shell;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ [Guid("6C6AC14F-9B11-47C1-BC90-DFBFB89B1CB8")]
+ [ComVisible(true)]
+ [ProvideObject(typeof(ReswFileVisualBasicCodeGeneratorInternal))]
+ [CodeGeneratorRegistration(typeof(ReswFileVisualBasicCodeGeneratorInternal),
+ "Visual Basic ResW File Code Generator (Internal class)",
+ Guids.ReswFileVisualBasicCodeGenerator,
+ GeneratesDesignTimeSource = true,
+ GeneratorRegKeyName = "InternalReswFileCodeGenerator")]
+ public class ReswFileVisualBasicCodeGeneratorInternal : ReswFileCodeGenerator
+ {
+ public ReswFileVisualBasicCodeGeneratorInternal()
+ : base(new VBCodeProvider(), TypeAttributes.NestedAssembly)
+ {
+ }
+
+ public override int DefaultExtension(out string pbstrDefaultExtension)
+ {
+ pbstrDefaultExtension = ".vb";
+ return 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/StringExtension.cs b/vs2017/VSPackage/CustomTool/StringExtension.cs
new file mode 100644
index 0000000..8134f07
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/StringExtension.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public static class StringExtension
+ {
+ public static IntPtr ConvertToIntPtr(this string code, out uint pcbOutput)
+ {
+ var data = Encoding.Default.GetBytes(code);
+
+ var ptr = Marshal.AllocCoTaskMem(data.Length);
+ Marshal.Copy(data, 0, ptr, data.Length);
+
+ pcbOutput = (uint)data.Length;
+ return ptr;
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/CustomTool/VisualStudioVersion.cs b/vs2017/VSPackage/CustomTool/VisualStudioVersion.cs
new file mode 100644
index 0000000..3f0c05d
--- /dev/null
+++ b/vs2017/VSPackage/CustomTool/VisualStudioVersion.cs
@@ -0,0 +1,9 @@
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage.CustomTool
+{
+ public enum VisualStudioVersion
+ {
+ VS2012,
+ VS2013,
+ Unknown
+ }
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/Guids.cs b/vs2017/VSPackage/Guids.cs
new file mode 100644
index 0000000..0c7030c
--- /dev/null
+++ b/vs2017/VSPackage/Guids.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
+{
+ internal static class Guids
+ {
+ public const string guidVSPackagePkgString = "6a4c1726-440f-4b2d-a2e5-711277da6099";
+ public const string guidVSPackageCmdSetString = "fb40dc0b-2f75-404c-ba4e-dc1b90c41941";
+
+ public const string ReswFileCSharpCodeGenerator = "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}";
+ public const string ReswFileVisualBasicCodeGenerator = "{164B10B9-B200-11D0-8C61-00A0C91E29D5}";
+
+ public static readonly Guid guidVSPackageCmdSet = new Guid(guidVSPackageCmdSetString);
+ };
+}
\ No newline at end of file
diff --git a/vs2017/VSPackage/License.txt b/vs2017/VSPackage/License.txt
new file mode 100644
index 0000000..5a8d1b9
--- /dev/null
+++ b/vs2017/VSPackage/License.txt
@@ -0,0 +1,88 @@
+GNU General Public License version 2 (GPLv2)
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
\ No newline at end of file
diff --git a/vs2017/VSPackage/Properties/AssemblyInfo.cs b/vs2017/VSPackage/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..d7a6859
--- /dev/null
+++ b/vs2017/VSPackage/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ResW File Code Generator")]
+[assembly: AssemblyDescription("A Visual Studio Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ReswFileCodeGen")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.5.*")]
+[assembly: AssemblyFileVersion("1.5.0.0")]
diff --git a/vs2017/VSPackage/VSPackage.csproj b/vs2017/VSPackage/VSPackage.csproj
new file mode 100644
index 0000000..42d4221
--- /dev/null
+++ b/vs2017/VSPackage/VSPackage.csproj
@@ -0,0 +1,167 @@
+
+
+
+ 15.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+ true
+
+
+
+ Debug
+ AnyCPU
+ 2.0
+ {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ {05F77BFB-CE11-4948-8174-F938C5B7F31C}
+ Library
+ Properties
+ ChristianHelle.DeveloperTools.CodeGenerators.Resw.VSPackage
+ ReswFileCodeGenerator
+ v4.5
+ true
+ true
+ false
+ true
+ true
+ true
+ Program
+ $(DevEnvDir)devenv.exe
+ /rootsuffix Exp
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Designer
+
+
+
+
+ False
+ ..\packages\EnvDTE.8.0.1\lib\net10\EnvDTE.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Imaging.14.3.25407\lib\net45\Microsoft.VisualStudio.Imaging.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.3.25407\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Utilities.14.3.25407\lib\net45\Microsoft.VisualStudio.Utilities.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll
+ True
+
+
+ True
+ ..\packages\stdole.7.0.3301\lib\net10\stdole.dll
+ True
+
+
+
+
+
+
+
+ Always
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vs2017/VSPackage/packages.config b/vs2017/VSPackage/packages.config
new file mode 100644
index 0000000..59ba7c6
--- /dev/null
+++ b/vs2017/VSPackage/packages.config
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vs2017/VSPackage/source.extension.vsixmanifest b/vs2017/VSPackage/source.extension.vsixmanifest
new file mode 100644
index 0000000..ba9d7f8
--- /dev/null
+++ b/vs2017/VSPackage/source.extension.vsixmanifest
@@ -0,0 +1,40 @@
+
+
+
+
+ ResW File Code Generator
+ A Visual Studio Custom Tool for generating a strongly typed helper class for accessing localized resources from a .ResW file.
+ http://visualstudiogallery.msdn.microsoft.com/3ab88efd-1afb-4ff5-9faf-8825a282596a
+ License.txt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+