mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00

--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4038902
3315 lines
159 KiB
XML
3315 lines
159 KiB
XML
<?xml version="1.0"?>
|
|
<doc>
|
|
<assembly>
|
|
<name>Moq</name>
|
|
</assembly>
|
|
<members>
|
|
<member name="T:Moq.EmptyDefaultValueProvider">
|
|
<summary>
|
|
A <see cref="T:Moq.IDefaultValueProvider"/> that returns an empty default value
|
|
for invocations that do not have setups or return values, with loose mocks.
|
|
This is the default behavior for a mock.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.IDefaultValueProvider">
|
|
<summary>
|
|
Interface to be implemented by classes that determine the
|
|
default value of non-expected invocations.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.IDefaultValueProvider.ProvideDefault(System.Reflection.MethodInfo)">
|
|
<summary>
|
|
Provides a value for the given member and arguments.
|
|
</summary>
|
|
<param name="member">The member to provide a default
|
|
value for.</param>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.IReturnsResult`1">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.ICallback">
|
|
<summary>
|
|
Defines the <c>Callback</c> verb and overloads.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.IHideObjectMembers">
|
|
<summary>
|
|
Helper interface used to hide the base <see cref="T:System.Object"/>
|
|
members from the fluent API to make it much cleaner
|
|
in Visual Studio intellisense.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.IHideObjectMembers.GetType">
|
|
<summary/>
|
|
</member>
|
|
<member name="M:Moq.IHideObjectMembers.GetHashCode">
|
|
<summary/>
|
|
</member>
|
|
<member name="M:Moq.IHideObjectMembers.ToString">
|
|
<summary/>
|
|
</member>
|
|
<member name="M:Moq.IHideObjectMembers.Equals(System.Object)">
|
|
<summary/>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback.Callback(System.Action)">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called.
|
|
</summary>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
The following example specifies a callback to set a boolean
|
|
value that can be used later:
|
|
<code>
|
|
bool called = false;
|
|
mock.Setup(x => x.Execute())
|
|
.Callback(() => called = true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback.Callback``1(System.Action{``0})">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called that receives the original
|
|
arguments.
|
|
</summary>
|
|
<typeparam name="T">Argument type of the invoked method.</typeparam>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the concrete invocation argument value.
|
|
<para>
|
|
Notice how the specific string argument is retrieved by simply declaring
|
|
it as part of the lambda expression for the callback:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(It.IsAny<string>()))
|
|
.Callback((string command) => Console.WriteLine(command));
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback.Callback``2(System.Action{``0,``1})">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called that receives the original
|
|
arguments.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the concrete invocation arguments values.
|
|
<para>
|
|
Notice how the specific arguments are retrieved by simply declaring
|
|
them as part of the lambda expression for the callback:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>()))
|
|
.Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2));
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback.Callback``3(System.Action{``0,``1,``2})">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called that receives the original
|
|
arguments.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the concrete invocation arguments values.
|
|
<para>
|
|
Notice how the specific arguments are retrieved by simply declaring
|
|
them as part of the lambda expression for the callback:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>(),
|
|
It.IsAny<int>()))
|
|
.Callback((string arg1, string arg2, int arg3) => Console.WriteLine(arg1 + arg2 + arg3));
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback.Callback``4(System.Action{``0,``1,``2,``3})">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called that receives the original
|
|
arguments.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
|
|
<typeparam name="T4">Type of the fourth argument of the invoked method.</typeparam>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the concrete invocation arguments values.
|
|
<para>
|
|
Notice how the specific arguments are retrieved by simply declaring
|
|
them as part of the lambda expression for the callback:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>(),
|
|
It.IsAny<int>(),
|
|
It.IsAny<bool>()))
|
|
.Callback((string arg1, string arg2, int arg3, bool arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.Language.IOccurrence">
|
|
<summary>
|
|
Defines occurrence members to constraint setups.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Language.IOccurrence.AtMostOnce">
|
|
<summary>
|
|
The expected invocation can happen at most once.
|
|
</summary>
|
|
<example>
|
|
<code>
|
|
var mock = new Mock<ICommand>();
|
|
mock.Setup(foo => foo.Execute("ping"))
|
|
.AtMostOnce();
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IOccurrence.AtMost(System.Int32)">
|
|
<summary>
|
|
The expected invocation can happen at most specified number of times.
|
|
</summary>
|
|
<param name="callCount">The number of times to accept calls.</param>
|
|
<example>
|
|
<code>
|
|
var mock = new Mock<ICommand>();
|
|
mock.Setup(foo => foo.Execute("ping"))
|
|
.AtMost( 5 );
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.Language.IRaise`1">
|
|
<summary>
|
|
Defines the <c>Raises</c> verb.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)">
|
|
<summary>
|
|
Specifies the event that will be raised
|
|
when the setup is met.
|
|
</summary>
|
|
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
|
|
<param name="args">The event arguments to pass for the raised event.</param>
|
|
<example>
|
|
The following example shows how to raise an event when
|
|
the setup is met:
|
|
<code>
|
|
var mock = new Mock<IContainer>();
|
|
|
|
mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>()))
|
|
.Raises(add => add.Added += null, EventArgs.Empty);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.Func{System.EventArgs})">
|
|
<summary>
|
|
Specifies the event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise`1.Raises``1(System.Action{`0},System.Func{``0,System.EventArgs})">
|
|
<summary>
|
|
Specifies the event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<typeparam name="T1">Type of the argument received by the expected invocation.</typeparam>
|
|
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise`1.Raises``2(System.Action{`0},System.Func{``0,``1,System.EventArgs})">
|
|
<summary>
|
|
Specifies the event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
|
|
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise`1.Raises``3(System.Action{`0},System.Func{``0,``1,``2,System.EventArgs})">
|
|
<summary>
|
|
Specifies the event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T3">Type of the third argument received by the expected invocation.</typeparam>
|
|
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise`1.Raises``4(System.Action{`0},System.Func{``0,``1,``2,``3,System.EventArgs})">
|
|
<summary>
|
|
Specifies the event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T3">Type of the third argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T4">Type of the fourth argument received by the expected invocation.</typeparam>
|
|
<seealso cref="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise`1.Raises(System.Action{`0},System.Object[])">
|
|
<summary>
|
|
Specifies the custom event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventExpression">An expression that represents an event attach or detach action.</param>
|
|
<param name="args">The arguments to pass to the custom delegate (non EventHandler-compatible).</param>
|
|
</member>
|
|
<member name="T:Moq.Language.IRaise">
|
|
<summary>
|
|
Defines the <c>Raises</c> verb.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)">
|
|
<summary>
|
|
Specifies the mocked event that will be raised
|
|
when the setup is met.
|
|
</summary>
|
|
<param name="eventHandler">The mocked event, retrieved from
|
|
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
|
|
</param>
|
|
<param name="args">The event args to pass when raising the event.</param>
|
|
<example>
|
|
The following example shows how to raise an event when
|
|
the setup is met:
|
|
<code>
|
|
var mock = new Mock<IContainer>();
|
|
// create handler to associate with the event to raise
|
|
var handler = mock.CreateEventHandler();
|
|
// associate the handler with the event to raise
|
|
mock.Object.Added += handler;
|
|
// setup the invocation and the handler to raise
|
|
mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>()))
|
|
.Raises(handler, EventArgs.Empty);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.Func{System.EventArgs})">
|
|
<summary>
|
|
Specifies the mocked event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventHandler">The mocked event, retrieved from
|
|
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
|
|
</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise.Raises``1(Moq.MockedEvent,System.Func{``0,System.EventArgs})">
|
|
<summary>
|
|
Specifies the mocked event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventHandler">The mocked event, retrieved from
|
|
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
|
|
</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<typeparam name="T">Type of the argument received by the expected invocation.</typeparam>
|
|
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise.Raises``2(Moq.MockedEvent,System.Func{``0,``1,System.EventArgs})">
|
|
<summary>
|
|
Specifies the mocked event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventHandler">The mocked event, retrieved from
|
|
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
|
|
</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
|
|
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise.Raises``3(Moq.MockedEvent,System.Func{``0,``1,``2,System.EventArgs})">
|
|
<summary>
|
|
Specifies the mocked event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventHandler">The mocked event, retrieved from
|
|
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
|
|
</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T3">Type of the third argument received by the expected invocation.</typeparam>
|
|
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
|
|
</member>
|
|
<member name="M:Moq.Language.IRaise.Raises``4(Moq.MockedEvent,System.Func{``0,``1,``2,``3,System.EventArgs})">
|
|
<summary>
|
|
Specifies the mocked event that will be raised
|
|
when the setup is matched.
|
|
</summary>
|
|
<param name="eventHandler">The mocked event, retrieved from
|
|
<see cref="M:Moq.Mock.CreateEventHandler"/> or <see cref="M:Moq.Mock.CreateEventHandler``1"/>.
|
|
</param>
|
|
<param name="func">A function that will build the <see cref="T:System.EventArgs"/>
|
|
to pass when raising the event.</param>
|
|
<typeparam name="T1">Type of the first argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T2">Type of the second argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T3">Type of the third argument received by the expected invocation.</typeparam>
|
|
<typeparam name="T4">Type of the fourth argument received by the expected invocation.</typeparam>
|
|
<seealso cref="M:Moq.Language.IRaise.Raises(Moq.MockedEvent,System.EventArgs)"/>
|
|
</member>
|
|
<member name="T:Moq.Language.IVerifies">
|
|
<summary>
|
|
Defines the <c>Verifiable</c> verb.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Language.IVerifies.Verifiable">
|
|
<summary>
|
|
Marks the expectation as verifiable, meaning that a call
|
|
to <see cref="M:Moq.Mock.Verify"/> will check if this particular
|
|
expectation was met.
|
|
</summary>
|
|
<example>
|
|
The following example marks the expectation as verifiable:
|
|
<code>
|
|
mock.Expect(x => x.Execute("ping"))
|
|
.Returns(true)
|
|
.Verifiable();
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IVerifies.Verifiable(System.String)">
|
|
<summary>
|
|
Marks the expectation as verifiable, meaning that a call
|
|
to <see cref="M:Moq.Mock.Verify"/> will check if this particular
|
|
expectation was met, and specifies a message for failures.
|
|
</summary>
|
|
<example>
|
|
The following example marks the expectation as verifiable:
|
|
<code>
|
|
mock.Expect(x => x.Execute("ping"))
|
|
.Returns(true)
|
|
.Verifiable("Ping should be executed always!");
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.MatcherAttribute">
|
|
<summary>
|
|
Marks a method as a matcher, which allows complete replacement
|
|
of the built-in <see cref="T:Moq.It"/> class with your own argument
|
|
matching rules.
|
|
</summary>
|
|
<remarks>
|
|
<b>This feature has been deprecated in favor of the new
|
|
and simpler <see cref="T:Moq.Match`1"/>.
|
|
</b>
|
|
<para>
|
|
The argument matching is used to determine whether a concrete
|
|
invocation in the mock matches a given setup. This
|
|
matching mechanism is fully extensible.
|
|
</para>
|
|
<para>
|
|
There are two parts of a matcher: the compiler matcher
|
|
and the runtime matcher.
|
|
<list type="bullet">
|
|
<item>
|
|
<term>Compiler matcher</term>
|
|
<description>Used to satisfy the compiler requirements for the
|
|
argument. Needs to be a method optionally receiving any arguments
|
|
you might need for the matching, but with a return type that
|
|
matches that of the argument.
|
|
<para>
|
|
Let's say I want to match a lists of orders that contains
|
|
a particular one. I might create a compiler matcher like the following:
|
|
</para>
|
|
<code>
|
|
public static class Orders
|
|
{
|
|
[Matcher]
|
|
public static IEnumerable<Order> Contains(Order order)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
</code>
|
|
Now we can invoke this static method instead of an argument in an
|
|
invocation:
|
|
<code>
|
|
var order = new Order { ... };
|
|
var mock = new Mock<IRepository<Order>>();
|
|
|
|
mock.Setup(x => x.Save(Orders.Contains(order)))
|
|
.Throws<ArgumentException>();
|
|
</code>
|
|
Note that the return value from the compiler matcher is irrelevant.
|
|
This method will never be called, and is just used to satisfy the
|
|
compiler and to signal Moq that this is not a method that we want
|
|
to be invoked at runtime.
|
|
</description>
|
|
</item>
|
|
<item>
|
|
<term>Runtime matcher</term>
|
|
<description>
|
|
The runtime matcher is the one that will actually perform evaluation
|
|
when the test is run, and is defined by convention to have the
|
|
same signature as the compiler matcher, but where the return
|
|
value is the first argument to the call, which contains the
|
|
object received by the actual invocation at runtime:
|
|
<code>
|
|
public static bool Contains(IEnumerable<Order> orders, Order order)
|
|
{
|
|
return orders.Contains(order);
|
|
}
|
|
</code>
|
|
At runtime, the mocked method will be invoked with a specific
|
|
list of orders. This value will be passed to this runtime
|
|
matcher as the first argument, while the second argument is the
|
|
one specified in the setup (<c>x.Save(Orders.Contains(order))</c>).
|
|
<para>
|
|
The boolean returned determines whether the given argument has been
|
|
matched. If all arguments to the expected method are matched, then
|
|
the setup matches and is evaluated.
|
|
</para>
|
|
</description>
|
|
</item>
|
|
</list>
|
|
</para>
|
|
Using this extensible infrastructure, you can easily replace the entire
|
|
<see cref="T:Moq.It"/> set of matchers with your own. You can also avoid the
|
|
typical (and annoying) lengthy expressions that result when you have
|
|
multiple arguments that use generics.
|
|
</remarks>
|
|
<example>
|
|
The following is the complete example explained above:
|
|
<code>
|
|
public static class Orders
|
|
{
|
|
[Matcher]
|
|
public static IEnumerable<Order> Contains(Order order)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public static bool Contains(IEnumerable<Order> orders, Order order)
|
|
{
|
|
return orders.Contains(order);
|
|
}
|
|
}
|
|
</code>
|
|
And the concrete test using this matcher:
|
|
<code>
|
|
var order = new Order { ... };
|
|
var mock = new Mock<IRepository<Order>>();
|
|
|
|
mock.Setup(x => x.Save(Orders.Contains(order)))
|
|
.Throws<ArgumentException>();
|
|
|
|
// use mock, invoke Save, and have the matcher filter.
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.ToLambda(System.Linq.Expressions.Expression)">
|
|
<summary>
|
|
Casts the expression to a lambda expression, removing
|
|
a cast if there's any.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.ToMethodCall(System.Linq.Expressions.LambdaExpression)">
|
|
<summary>
|
|
Casts the body of the lambda expression to a <see cref="T:System.Linq.Expressions.MethodCallExpression"/>.
|
|
</summary>
|
|
<exception cref="T:System.ArgumentException">If the body is not a method call.</exception>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.ToPropertyInfo(System.Linq.Expressions.LambdaExpression)">
|
|
<summary>
|
|
Converts the body of the lambda expression into the <see cref="T:System.Reflection.PropertyInfo"/> referenced by it.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.IsProperty(System.Linq.Expressions.LambdaExpression)">
|
|
<summary>
|
|
Checks whether the body of the lambda expression is a property access.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.IsProperty(System.Linq.Expressions.Expression)">
|
|
<summary>
|
|
Checks whether the expression is a property access.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.IsPropertyIndexer(System.Linq.Expressions.LambdaExpression)">
|
|
<summary>
|
|
Checks whether the body of the lambda expression is a property indexer, which is true
|
|
when the expression is an <see cref="T:System.Linq.Expressions.MethodCallExpression"/> whose
|
|
<see cref="P:System.Linq.Expressions.MethodCallExpression.Method"/> has <see cref="P:System.Reflection.MethodBase.IsSpecialName"/>
|
|
equal to <see langword="true"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.IsPropertyIndexer(System.Linq.Expressions.Expression)">
|
|
<summary>
|
|
Checks whether the expression is a property indexer, which is true
|
|
when the expression is an <see cref="T:System.Linq.Expressions.MethodCallExpression"/> whose
|
|
<see cref="P:System.Linq.Expressions.MethodCallExpression.Method"/> has <see cref="P:System.Reflection.MethodBase.IsSpecialName"/>
|
|
equal to <see langword="true"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.CastTo``1(System.Linq.Expressions.Expression)">
|
|
<summary>
|
|
Creates an expression that casts the given expression to the <typeparamref name="T"/>
|
|
type.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.ExpressionExtensions.ToStringFixed(System.Linq.Expressions.Expression)">
|
|
<devdoc>
|
|
TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583
|
|
is fixed.
|
|
</devdoc>
|
|
</member>
|
|
<member name="T:Moq.Evaluator">
|
|
<summary>
|
|
Provides partial evaluation of subtrees, whenever they can be evaluated locally.
|
|
</summary>
|
|
<author>Matt Warren: http://blogs.msdn.com/mattwar</author>
|
|
<contributor>Documented by InSTEDD: http://www.instedd.org</contributor>
|
|
</member>
|
|
<member name="M:Moq.Evaluator.PartialEval(System.Linq.Expressions.Expression,System.Func{System.Linq.Expressions.Expression,System.Boolean})">
|
|
<summary>
|
|
Performs evaluation and replacement of independent sub-trees
|
|
</summary>
|
|
<param name="expression">The root of the expression tree.</param>
|
|
<param name="fnCanBeEvaluated">A function that decides whether a given expression
|
|
node can be part of the local function.</param>
|
|
<returns>A new tree with sub-trees evaluated and replaced.</returns>
|
|
</member>
|
|
<member name="M:Moq.Evaluator.PartialEval(System.Linq.Expressions.Expression)">
|
|
<summary>
|
|
Performs evaluation and replacement of independent sub-trees
|
|
</summary>
|
|
<param name="expression">The root of the expression tree.</param>
|
|
<returns>A new tree with sub-trees evaluated and replaced.</returns>
|
|
</member>
|
|
<member name="T:Moq.Evaluator.SubtreeEvaluator">
|
|
<summary>
|
|
Evaluates and replaces sub-trees when first candidate is reached (top-down)
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Evaluator.Nominator">
|
|
<summary>
|
|
Performs bottom-up analysis to determine which nodes can possibly
|
|
be part of an evaluated sub-tree.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Guard.ArgumentNotNull(System.Object,System.String)">
|
|
<summary>
|
|
Checks an argument to ensure it isn't null.
|
|
</summary>
|
|
<param name="value">The argument value to check.</param>
|
|
<param name="argumentName">The name of the argument.</param>
|
|
</member>
|
|
<member name="M:Guard.ArgumentNotNullOrEmptyString(System.String,System.String)">
|
|
<summary>
|
|
Checks a string argument to ensure it isn't null or empty.
|
|
</summary>
|
|
<param name="argumentValue">The argument value to check.</param>
|
|
<param name="argumentName">The name of the argument.</param>
|
|
</member>
|
|
<member name="M:Guard.ArgumentNotOutOfRangeInclusive``1(``0,``0,``0,System.String)">
|
|
<summary>
|
|
Checks an argument to ensure it is in the specified range including the edges.
|
|
</summary>
|
|
<typeparam name="T">Type of the argument to check, it must be an <see cref="T:System.IComparable"/> type.
|
|
</typeparam>
|
|
<param name="value">The argument value to check.</param>
|
|
<param name="from">The minimun allowed value for the argument.</param>
|
|
<param name="to">The maximun allowed value for the argument.</param>
|
|
<param name="argumentName">The name of the argument.</param>
|
|
</member>
|
|
<member name="M:Guard.ArgumentNotOutOfRangeExclusive``1(``0,``0,``0,System.String)">
|
|
<summary>
|
|
Checks an argument to ensure it is in the specified range excluding the edges.
|
|
</summary>
|
|
<typeparam name="T">Type of the argument to check, it must be an <see cref="T:System.IComparable"/> type.
|
|
</typeparam>
|
|
<param name="value">The argument value to check.</param>
|
|
<param name="from">The minimun allowed value for the argument.</param>
|
|
<param name="to">The maximun allowed value for the argument.</param>
|
|
<param name="argumentName">The name of the argument.</param>
|
|
</member>
|
|
<member name="T:Moq.Language.IReturnsGetter`2">
|
|
<summary>
|
|
Defines the <c>Returns</c> verb for property get setups.
|
|
</summary>
|
|
<typeparam name="TMock">Mocked type.</typeparam>
|
|
<typeparam name="TProperty">Type of the property.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Language.IReturnsGetter`2.Returns(`1)">
|
|
<summary>
|
|
Specifies the value to return.
|
|
</summary>
|
|
<param name="value">The value to return, or <see langword="null"/>.</param>
|
|
<example>
|
|
Return a <c>true</c> value from the property getter call:
|
|
<code>
|
|
mock.SetupGet(x => x.Suspended)
|
|
.Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IReturnsGetter`2.Returns(System.Func{`1})">
|
|
<summary>
|
|
Specifies a function that will calculate the value to return for the property.
|
|
</summary>
|
|
<param name="valueFunction">The function that will calculate the return value.</param>
|
|
<example>
|
|
Return a calculated value when the property is retrieved:
|
|
<code>
|
|
mock.SetupGet(x => x.Suspended)
|
|
.Returns(() => returnValues[0]);
|
|
</code>
|
|
The lambda expression to retrieve the return value is lazy-executed,
|
|
meaning that its value may change depending on the moment the property
|
|
is retrieved and the value the <c>returnValues</c> array has at
|
|
that moment.
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.Language.ICallbackGetter`2">
|
|
<summary>
|
|
Defines the <c>Callback</c> verb for property getter setups.
|
|
</summary>
|
|
<seealso cref="M:Moq.Mock`1.SetupGet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})"/>
|
|
<typeparam name="TMock">Mocked type.</typeparam>
|
|
<typeparam name="TProperty">Type of the property.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallbackGetter`2.Callback(System.Action)">
|
|
<summary>
|
|
Specifies a callback to invoke when the property is retrieved.
|
|
</summary>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the property value being set.
|
|
<code>
|
|
mock.SetupGet(x => x.Suspended)
|
|
.Callback(() => called = true)
|
|
.Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.IThrowsResult">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.IReturnsThrows`2">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.IReturns`2">
|
|
<summary>
|
|
Defines the <c>Returns</c> verb.
|
|
</summary>
|
|
<typeparam name="TMock">Mocked type.</typeparam>
|
|
<typeparam name="TResult">Type of the return value from the expression.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Language.IReturns`2.Returns(`1)">
|
|
<summary>
|
|
Specifies the value to return.
|
|
</summary>
|
|
<param name="value">The value to return, or <see langword="null"/>.</param>
|
|
<example>
|
|
Return a <c>true</c> value from the method call:
|
|
<code>
|
|
mock.Setup(x => x.Execute("ping"))
|
|
.Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IReturns`2.Returns(System.Func{`1})">
|
|
<summary>
|
|
Specifies a function that will calculate the value to return from the method.
|
|
</summary>
|
|
<param name="valueFunction">The function that will calculate the return value.</param>
|
|
<example group="returns">
|
|
Return a calculated value when the method is called:
|
|
<code>
|
|
mock.Setup(x => x.Execute("ping"))
|
|
.Returns(() => returnValues[0]);
|
|
</code>
|
|
The lambda expression to retrieve the return value is lazy-executed,
|
|
meaning that its value may change depending on the moment the method
|
|
is executed and the value the <c>returnValues</c> array has at
|
|
that moment.
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IReturns`2.Returns``1(System.Func{``0,`1})">
|
|
<summary>
|
|
Specifies a function that will calculate the value to return from the method,
|
|
retrieving the arguments for the invocation.
|
|
</summary>
|
|
<typeparam name="T">Type of the argument of the invoked method.</typeparam>
|
|
<param name="valueFunction">The function that will calculate the return value.</param>
|
|
<example group="returns">
|
|
Return a calculated value which is evaluated lazily at the time of the invocation.
|
|
<para>
|
|
The lookup list can change between invocations and the setup
|
|
will return different values accordingly. Also, notice how the specific
|
|
string argument is retrieved by simply declaring it as part of the lambda
|
|
expression:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(It.IsAny<string>()))
|
|
.Returns((string command) => returnValues[command]);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IReturns`2.Returns``2(System.Func{``0,``1,`1})">
|
|
<summary>
|
|
Specifies a function that will calculate the value to return from the method,
|
|
retrieving the arguments for the invocation.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<param name="valueFunction">The function that will calculate the return value.</param>
|
|
<example group="returns">
|
|
Return a calculated value which is evaluated lazily at the time of the invocation.
|
|
<para>
|
|
The return value is calculated from the value of the actual method invocation arguments.
|
|
Notice how the arguments are retrieved by simply declaring them as part of the lambda
|
|
expression:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>()))
|
|
.Returns((string arg1, string arg2) => arg1 + arg2);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IReturns`2.Returns``3(System.Func{``0,``1,``2,`1})">
|
|
<summary>
|
|
Specifies a function that will calculate the value to return from the method,
|
|
retrieving the arguments for the invocation.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
|
|
<param name="valueFunction">The function that will calculate the return value.</param>
|
|
<example group="returns">
|
|
Return a calculated value which is evaluated lazily at the time of the invocation.
|
|
<para>
|
|
The return value is calculated from the value of the actual method invocation arguments.
|
|
Notice how the arguments are retrieved by simply declaring them as part of the lambda
|
|
expression:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>(),
|
|
It.IsAny<int>()))
|
|
.Returns((string arg1, string arg2, int arg3) => arg1 + arg2 + arg3);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IReturns`2.Returns``4(System.Func{``0,``1,``2,``3,`1})">
|
|
<summary>
|
|
Specifies a function that will calculate the value to return from the method,
|
|
retrieving the arguments for the invocation.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
|
|
<typeparam name="T4">Type of the fourth argument of the invoked method.</typeparam>
|
|
<param name="valueFunction">The function that will calculate the return value.</param>
|
|
<example group="returns">
|
|
Return a calculated value which is evaluated lazily at the time of the invocation.
|
|
<para>
|
|
The return value is calculated from the value of the actual method invocation arguments.
|
|
Notice how the arguments are retrieved by simply declaring them as part of the lambda
|
|
expression:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>(),
|
|
It.IsAny<int>(),
|
|
It.IsAny<bool>()))
|
|
.Returns((string arg1, string arg2, int arg3, bool arg4) => arg1 + arg2 + arg3 + arg4);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.Language.IThrows">
|
|
<summary>
|
|
Defines the <c>Throws</c> verb.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Language.IThrows.Throws(System.Exception)">
|
|
<summary>
|
|
Specifies the exception to throw when the method is invoked.
|
|
</summary>
|
|
<param name="exception">Exception instance to throw.</param>
|
|
<example>
|
|
This example shows how to throw an exception when the method is
|
|
invoked with an empty string argument:
|
|
<code>
|
|
mock.Setup(x => x.Execute(""))
|
|
.Throws(new ArgumentException());
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.IThrows.Throws``1">
|
|
<summary>
|
|
Specifies the type of exception to throw when the method is invoked.
|
|
</summary>
|
|
<typeparam name="TException">Type of exception to instantiate and throw when the setup is matched.</typeparam>
|
|
<example>
|
|
This example shows how to throw an exception when the method is
|
|
invoked with an empty string argument:
|
|
<code>
|
|
mock.Setup(x => x.Execute(""))
|
|
.Throws<ArgumentException>();
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.IReturnsThrowsGetter`2">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.ICallbackResult">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.ICallback`2">
|
|
<summary>
|
|
Defines the <c>Callback</c> verb and overloads for callbacks on
|
|
setups that return a value.
|
|
</summary>
|
|
<typeparam name="TMock">Mocked type.</typeparam>
|
|
<typeparam name="TResult">Type of the return value of the setup.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback`2.Callback(System.Action)">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called.
|
|
</summary>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
The following example specifies a callback to set a boolean
|
|
value that can be used later:
|
|
<code>
|
|
bool called = false;
|
|
mock.Setup(x => x.Execute())
|
|
.Callback(() => called = true)
|
|
.Returns(true);
|
|
</code>
|
|
Note that in the case of value-returning methods, after the <c>Callback</c>
|
|
call you can still specify the return value.
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback`2.Callback``1(System.Action{``0})">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called that receives the original
|
|
arguments.
|
|
</summary>
|
|
<typeparam name="T">Type of the argument of the invoked method.</typeparam>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the concrete invocation argument value.
|
|
<para>
|
|
Notice how the specific string argument is retrieved by simply declaring
|
|
it as part of the lambda expression for the callback:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(It.IsAny<string>()))
|
|
.Callback((string command) => Console.WriteLine(command))
|
|
.Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback`2.Callback``2(System.Action{``0,``1})">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called that receives the original
|
|
arguments.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the concrete invocation arguments values.
|
|
<para>
|
|
Notice how the specific arguments are retrieved by simply declaring
|
|
them as part of the lambda expression for the callback:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>()))
|
|
.Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2))
|
|
.Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback`2.Callback``3(System.Action{``0,``1,``2})">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called that receives the original
|
|
arguments.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the concrete invocation arguments values.
|
|
<para>
|
|
Notice how the specific arguments are retrieved by simply declaring
|
|
them as part of the lambda expression for the callback:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>(),
|
|
It.IsAny<int>()))
|
|
.Callback((string arg1, string arg2, int arg3) => Console.WriteLine(arg1 + arg2 + arg3))
|
|
.Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallback`2.Callback``4(System.Action{``0,``1,``2,``3})">
|
|
<summary>
|
|
Specifies a callback to invoke when the method is called that receives the original
|
|
arguments.
|
|
</summary>
|
|
<typeparam name="T1">Type of the first argument of the invoked method.</typeparam>
|
|
<typeparam name="T2">Type of the second argument of the invoked method.</typeparam>
|
|
<typeparam name="T3">Type of the third argument of the invoked method.</typeparam>
|
|
<typeparam name="T4">Type of the fourth argument of the invoked method.</typeparam>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the concrete invocation arguments values.
|
|
<para>
|
|
Notice how the specific arguments are retrieved by simply declaring
|
|
them as part of the lambda expression for the callback:
|
|
</para>
|
|
<code>
|
|
mock.Setup(x => x.Execute(
|
|
It.IsAny<string>(),
|
|
It.IsAny<string>(),
|
|
It.IsAny<int>(),
|
|
It.IsAny<bool>()))
|
|
.Callback((string arg1, string arg2, int arg3, bool arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4))
|
|
.Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.IMocked`1">
|
|
<summary>
|
|
Implemented by all generated mock object instances.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.IMocked">
|
|
<summary>
|
|
Implemented by all generated mock object instances.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.IMocked.Mock">
|
|
<summary>
|
|
Reference the Mock that contains this as the <c>mock.Object</c> value.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.IMocked`1.Mock">
|
|
<summary>
|
|
Reference the Mock that contains this as the <c>mock.Object</c> value.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Interceptor">
|
|
<summary>
|
|
Implements the actual interception and method invocation for
|
|
all mocks.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Interceptor.GetEventFromName(System.String)">
|
|
<summary>
|
|
Get an eventInfo for a given event name. Search type ancestors depth first if necessary.
|
|
</summary>
|
|
<param name="eventName">Name of the event, with the set_ or get_ prefix already removed</param>
|
|
</member>
|
|
<member name="M:Moq.Interceptor.GetAncestorTypes(System.Type)">
|
|
<summary>
|
|
Given a type return all of its ancestors, both types and interfaces.
|
|
</summary>
|
|
<param name="initialType">The type to find immediate ancestors of</param>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.ISetup`1">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.INever">
|
|
<summary>
|
|
Defines the <c>Never</c> verb.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Language.INever.Never">
|
|
<summary>
|
|
The expected invocation is never expected to happen.
|
|
</summary>
|
|
<example>
|
|
<code>
|
|
var mock = new Mock<ICommand>();
|
|
mock.Setup(foo => foo.Execute("ping"))
|
|
.Never();
|
|
</code>
|
|
</example>
|
|
<remarks>
|
|
<see cref="M:Moq.Language.INever.Never"/> is always verified inmediately as
|
|
the invocations are performed, like strict mocks do
|
|
with unexpected invocations.
|
|
</remarks>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.ISetup`2">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.ISetupGetter`2">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.Flow.ISetupSetter`2">
|
|
<summary>
|
|
Implements the fluent API.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Language.ICallbackSetter`1">
|
|
<summary>
|
|
Defines the <c>Callback</c> verb for property setter setups.
|
|
</summary>
|
|
<typeparam name="TProperty">Type of the property.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Language.ICallbackSetter`1.Callback(System.Action{`0})">
|
|
<summary>
|
|
Specifies a callback to invoke when the property is set that receives the
|
|
property value being set.
|
|
</summary>
|
|
<param name="action">Callback method to invoke.</param>
|
|
<example>
|
|
Invokes the given callback with the property value being set.
|
|
<code>
|
|
mock.SetupSet(x => x.Suspended)
|
|
.Callback((bool state) => Console.WriteLine(state));
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.It">
|
|
<summary>
|
|
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.
|
|
</summary><remarks>
|
|
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.
|
|
</remarks>
|
|
</member>
|
|
<member name="M:Moq.It.IsAny``1">
|
|
<summary>
|
|
Matches any value of the given <paramref name="TValue"/> type.
|
|
</summary><remarks>
|
|
Typically used when the actual argument value for a method
|
|
call is not relevant.
|
|
</remarks><example>
|
|
<code>
|
|
// Throws an exception for a call to Remove with any string value.
|
|
mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException());
|
|
</code>
|
|
</example><typeparam name="TValue">Type of the value.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.It.Is``1(System.Linq.Expressions.Expression{System.Predicate{``0}})">
|
|
<summary>
|
|
Matches any value that satisfies the given predicate.
|
|
</summary><typeparam name="TValue">Type of the argument to check.</typeparam><param name="match">The predicate used to match the method argument.</param><remarks>
|
|
Allows the specification of a predicate to perform matching
|
|
of method call arguments.
|
|
</remarks><example>
|
|
This example shows how to return the value <c>1</c> whenever the argument to the
|
|
<c>Do</c> method is an even number.
|
|
<code>
|
|
mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0)))
|
|
.Returns(1);
|
|
</code>
|
|
This example shows how to throw an exception if the argument to the
|
|
method is a negative number:
|
|
<code>
|
|
mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0)))
|
|
.Throws(new ArgumentException());
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.It.IsInRange``1(``0,``0,Moq.Range)">
|
|
<summary>
|
|
Matches any value that is in the range specified.
|
|
</summary><typeparam name="TValue">Type of the argument to check.</typeparam><param name="from">The lower bound of the range.</param><param name="to">The upper bound of the range.</param><param name="rangeKind">
|
|
The kind of range. See <see cref="T:Moq.Range"/>.
|
|
</param><example>
|
|
The following example shows how to expect a method call
|
|
with an integer argument within the 0..100 range.
|
|
<code>
|
|
mock.Setup(x => x.HasInventory(
|
|
It.IsAny<string>(),
|
|
It.IsInRange(0, 100, Range.Inclusive)))
|
|
.Returns(false);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.It.IsRegex(System.String)">
|
|
<summary>
|
|
Matches a string argument if it matches the given regular expression pattern.
|
|
</summary><param name="regex">The pattern to use to match the string argument value.</param><example>
|
|
The following example shows how to expect a call to a method where the
|
|
string argument matches the given regular expression:
|
|
<code>
|
|
mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.It.IsRegex(System.String,System.Text.RegularExpressions.RegexOptions)">
|
|
<summary>
|
|
Matches a string argument if it matches the given regular expression pattern.
|
|
</summary><param name="regex">The pattern to use to match the string argument value.</param><param name="options">The options used to interpret the pattern.</param><example>
|
|
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:
|
|
<code>
|
|
mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.Matchers.MatcherAttributeMatcher">
|
|
<summary>
|
|
Matcher to treat static functions as matchers.
|
|
|
|
mock.Setup(x => x.StringMethod(A.MagicString()));
|
|
|
|
pbulic static class A
|
|
{
|
|
[Matcher]
|
|
public static string MagicString() { return null; }
|
|
public static bool MagicString(string arg)
|
|
{
|
|
return arg == "magic";
|
|
}
|
|
}
|
|
|
|
Will success if: mock.Object.StringMethod("magic");
|
|
and fail with any other call.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MethodCallReturn">
|
|
<devdoc>
|
|
We need this non-generics base class so that
|
|
we can use <see cref="P:Moq.MethodCallReturn.HasReturnValue"/> from
|
|
generic code.
|
|
</devdoc>
|
|
</member>
|
|
<member name="T:Moq.Mock">
|
|
<summary>
|
|
Base class for mocks and static helper class with methods that
|
|
apply to mocked objects, such as <see cref="M:Moq.Mock.Get``1(``0)"/> to
|
|
retrieve a <see cref="T:Moq.Mock`1"/> from an object instance.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock.#ctor">
|
|
<summary>
|
|
Initializes a new instance of the <see cref="T:Moq.Mock"/> class.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock.Get``1(``0)">
|
|
<summary>
|
|
Retrieves the mock object for the given object instance.
|
|
</summary><typeparam name="T">
|
|
Type of the mock to retrieve. Can be omitted as it's inferred
|
|
from the object instance passed in as the <paramref name="mocked"/> instance.
|
|
</typeparam><param name="mocked">The instance of the mocked object.</param><returns>The mock associated with the mocked object.</returns><exception cref="T:System.ArgumentException">
|
|
The received <paramref name="mocked"/> instance
|
|
was not created by Moq.
|
|
</exception><example group="advanced">
|
|
The following example shows how to add a new setup to an object
|
|
instance which is not the original <see cref="T:Moq.Mock`1"/> but rather
|
|
the object associated with it:
|
|
<code>
|
|
// 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);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock.OnGetObject">
|
|
<summary>
|
|
Returns the mocked object value.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock.Verify">
|
|
<summary>
|
|
Verifies that all verifiable expectations have been met.
|
|
</summary><example group="verification">
|
|
This example sets up an expectation and marks it as verifiable. After
|
|
the mock is used, a <c>Verify()</c> call is issued on the mock
|
|
to ensure the method in the setup was invoked:
|
|
<code>
|
|
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();
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">Not all verifiable expectations were met.</exception>
|
|
</member>
|
|
<member name="M:Moq.Mock.VerifyAll">
|
|
<summary>
|
|
Verifies all expectations regardless of whether they have
|
|
been flagged as verifiable.
|
|
</summary><example group="verification">
|
|
This example sets up an expectation without marking it as verifiable. After
|
|
the mock is used, a <see cref="M:Moq.Mock.VerifyAll"/> call is issued on the mock
|
|
to ensure that all expectations are met:
|
|
<code>
|
|
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();
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">At least one expectation was not met.</exception>
|
|
</member>
|
|
<member name="M:Moq.Mock.GetInterceptor(System.Linq.Expressions.LambdaExpression,Moq.Mock)">
|
|
<summary>
|
|
Gets the interceptor target for the given expression and root mock,
|
|
building the intermediate hierarchy of mock objects if necessary.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock.CreateEventHandler``1">
|
|
<summary>
|
|
Creates a handler that can be associated to an event receiving
|
|
the given <typeparamref name="TEventArgs"/> and can be used
|
|
to raise the event.
|
|
</summary><typeparam name="TEventArgs">
|
|
Type of <see cref="T:System.EventArgs"/>
|
|
data passed in to the event.
|
|
</typeparam><example>
|
|
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:
|
|
<code>
|
|
var mockView = new Mock<IOrdersView>();
|
|
var mockedEvent = mockView.CreateEventHandler<OrderEventArgs>();
|
|
|
|
var presenter = new OrdersPresenter(mockView.Object);
|
|
|
|
// Check that the presenter has no selection by default
|
|
Assert.Null(presenter.SelectedOrder);
|
|
|
|
// Create a mock event handler of the appropriate type
|
|
var handler = mockView.CreateEventHandler<OrderEventArgs>();
|
|
// Associate it with the event we want to raise
|
|
mockView.Object.Cancel += handler;
|
|
// Finally raise the event with a specific arguments data
|
|
handler.Raise(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);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock.CreateEventHandler">
|
|
<summary>
|
|
Creates a handler that can be associated to an event receiving
|
|
a generic <see cref="T:System.EventArgs"/> and can be used
|
|
to raise the event.
|
|
</summary><example>
|
|
This example shows how to invoke a generic event in a view that will
|
|
cause its corresponding presenter to react by changing its state:
|
|
<code>
|
|
var mockView = new Mock<IOrdersView>();
|
|
var mockedEvent = mockView.CreateEventHandler();
|
|
|
|
var presenter = new OrdersPresenter(mockView.Object);
|
|
|
|
// Check that the presenter is not in the "Canceled" state
|
|
Assert.False(presenter.IsCanceled);
|
|
|
|
// Create a mock event handler of the appropriate type
|
|
var handler = mockView.CreateEventHandler();
|
|
// Associate it with the event we want to raise
|
|
mockView.Object.Cancel += handler;
|
|
// Finally raise the event
|
|
handler.Raise(EventArgs.Empty);
|
|
|
|
// Now the presenter reacted to the event, and changed its state
|
|
Assert.True(presenter.IsCanceled);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock.As``1">
|
|
<summary>
|
|
Adds an interface implementation to the mock,
|
|
allowing setups to be specified for it.
|
|
</summary><remarks>
|
|
This method can only be called before the first use
|
|
of the mock <see cref="P:Moq.Mock.Object"/> property, at which
|
|
point the runtime type has already been generated
|
|
and no more interfaces can be added to it.
|
|
<para>
|
|
Also, <typeparamref name="TInterface"/> must be an
|
|
interface and not a class, which must be specified
|
|
when creating the mock instead.
|
|
</para>
|
|
</remarks><exception cref="T:System.InvalidOperationException">
|
|
The mock type
|
|
has already been generated by accessing the <see cref="P:Moq.Mock.Object"/> property.
|
|
</exception><exception cref="T:System.ArgumentException">
|
|
The <typeparamref name="TInterface"/> specified
|
|
is not an interface.
|
|
</exception><example>
|
|
The following example creates a mock for the main interface
|
|
and later adds <see cref="T:System.IDisposable"/> to it to verify
|
|
it's called by the consumer code:
|
|
<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();
|
|
</code>
|
|
</example><typeparam name="TInterface">Type of interface to cast the mock to.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock.Moq#IHideObjectMembers#GetType">
|
|
<summary>
|
|
Base class for mocks and static helper class with methods that
|
|
apply to mocked objects, such as <see cref="M:Moq.Mock.Get``1(``0)"/> to
|
|
retrieve a <see cref="T:Moq.Mock`1"/> from an object instance.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Mock.Behavior">
|
|
<summary>
|
|
Behavior of the mock, according to the value set in the constructor.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Mock.CallBase">
|
|
<summary>
|
|
Whether the base member virtual implementation will be called
|
|
for mocked classes if no setup is matched. Defaults to <see langword="false"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Mock.DefaultValue">
|
|
<summary>
|
|
Specifies the behavior to use when returning default values for
|
|
unexpected invocations on loose mocks.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Mock.Object">
|
|
<summary>
|
|
Gets the mocked object instance, which is of the mocked type <typeparamref name="T"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Mock.MockedType">
|
|
<summary>
|
|
Retrieves the type of the mocked object, its generic type argument.
|
|
This is used in the auto-mocking of hierarchy access.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Mock.DefaultValueProvider">
|
|
<summary>
|
|
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).
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Mock.ImplementedInterfaces">
|
|
<summary>
|
|
Exposes the list of extra interfaces implemented by the mock.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MockBehavior">
|
|
<summary>
|
|
Options to customize the behavior of the mock.
|
|
</summary>
|
|
</member>
|
|
<member name="F:Moq.MockBehavior.Strict">
|
|
<summary>
|
|
Causes the mock to always throw
|
|
an exception for invocations that don't have a
|
|
corresponding setup.
|
|
</summary>
|
|
</member>
|
|
<member name="F:Moq.MockBehavior.Loose">
|
|
<summary>
|
|
Will never throw exceptions, returning default
|
|
values when necessary (null for reference types,
|
|
zero for value types or empty enumerables and arrays).
|
|
</summary>
|
|
</member>
|
|
<member name="F:Moq.MockBehavior.Default">
|
|
<summary>
|
|
Default mock behavior, which equals <see cref="F:Moq.MockBehavior.Loose"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MockedEvent">
|
|
<summary>
|
|
Represents a generic event that has been mocked and can
|
|
be rised.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.MockedEvent.Handle(System.Object,System.EventArgs)">
|
|
<summary>
|
|
Provided solely to allow the interceptor to determine when the attached
|
|
handler is coming from this mocked event so we can assign the
|
|
corresponding EventInfo for it.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.MockedEvent.DoRaise(System.EventArgs)">
|
|
<summary>
|
|
Raises the associated event with the given
|
|
event argument data.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.MockedEvent.DoRaise(System.Object[])">
|
|
<summary>
|
|
Raises the associated event with the given
|
|
event argument data.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.MockedEvent.op_Implicit(Moq.MockedEvent)~System.EventHandler">
|
|
<summary>
|
|
Provides support for attaching a <see cref="T:Moq.MockedEvent"/> to
|
|
a generic <see cref="T:System.EventHandler"/> event.
|
|
</summary>
|
|
<param name="mockEvent">Event to convert.</param>
|
|
</member>
|
|
<member name="E:Moq.MockedEvent.Raised">
|
|
<summary>
|
|
Event raised whenever the mocked event is rised.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MockException">
|
|
<summary>
|
|
Exception thrown by mocks when setups are not matched,
|
|
the mock is not properly setup, etc.
|
|
</summary>
|
|
<remarks>
|
|
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).
|
|
<para>
|
|
Richer exception hierarchy/types are not provided as
|
|
tests typically should <b>not</b> 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.
|
|
</para>
|
|
</remarks>
|
|
</member>
|
|
<member name="M:Moq.MockException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
|
<summary>
|
|
Supports the serialization infrastructure.
|
|
</summary>
|
|
<param name="info">Serialization information.</param>
|
|
<param name="context">Streaming context.</param>
|
|
</member>
|
|
<member name="M:Moq.MockException.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
|
<summary>
|
|
Supports the serialization infrastructure.
|
|
</summary>
|
|
<param name="info">Serialization information.</param>
|
|
<param name="context">Streaming context.</param>
|
|
</member>
|
|
<member name="T:Moq.MockException.ExceptionReason">
|
|
<summary>
|
|
Made internal as it's of no use for
|
|
consumers, but it's important for
|
|
our own tests.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MockVerificationException">
|
|
<devdoc>
|
|
Used by the mock factory to accumulate verification
|
|
failures.
|
|
</devdoc>
|
|
</member>
|
|
<member name="M:Moq.MockVerificationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
|
<summary>
|
|
Supports the serialization infrastructure.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MockFactory">
|
|
<summary>
|
|
Utility factory class to use to construct multiple
|
|
mocks when consistent verification is
|
|
desired for all of them.
|
|
</summary>
|
|
<remarks>
|
|
If multiple mocks will be created during a test, passing
|
|
the desired <see cref="T:Moq.MockBehavior"/> (if different than the
|
|
<see cref="F:Moq.MockBehavior.Default"/> or the one
|
|
passed to the factory constructor) and later verifying each
|
|
mock can become repetitive and tedious.
|
|
<para>
|
|
This factory class helps in that scenario by providing a
|
|
simplified creation of multiple mocks with a default
|
|
<see cref="T:Moq.MockBehavior"/> (unless overriden by calling
|
|
<see cref="M:Moq.MockFactory.Create``1(Moq.MockBehavior)"/>) and posterior verification.
|
|
</para>
|
|
</remarks>
|
|
<example group="factory">
|
|
The following is a straightforward example on how to
|
|
create and automatically verify strict mocks using a <see cref="T:Moq.MockFactory"/>:
|
|
<code>
|
|
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.
|
|
</code>
|
|
The following examples shows how to setup the factory
|
|
to create loose mocks and later verify only verifiable setups:
|
|
<code>
|
|
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.
|
|
</code>
|
|
The following examples shows how to setup the factory with a
|
|
default strict behavior, overriding that default for a
|
|
specific mock:
|
|
<code>
|
|
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();
|
|
</code>
|
|
</example>
|
|
<seealso cref="T:Moq.MockBehavior"/>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.#ctor(Moq.MockBehavior)">
|
|
<summary>
|
|
Initializes the factory with the given <paramref name="defaultBehavior"/>
|
|
for newly created mocks from the factory.
|
|
</summary>
|
|
<param name="defaultBehavior">The behavior to use for mocks created
|
|
using the <see cref="M:Moq.MockFactory.Create``1"/> factory method if not overriden
|
|
by using the <see cref="M:Moq.MockFactory.Create``1(Moq.MockBehavior)"/> overload.</param>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.Create``1">
|
|
<summary>
|
|
Creates a new mock with the default <see cref="T:Moq.MockBehavior"/>
|
|
specified at factory construction time.
|
|
</summary>
|
|
<typeparam name="T">Type to mock.</typeparam>
|
|
<returns>A new <see cref="T:Moq.Mock`1"/>.</returns>
|
|
<example ignore="true">
|
|
<code>
|
|
var factory = new MockFactory(MockBehavior.Strict);
|
|
|
|
var foo = factory.Create<IFoo>();
|
|
// use mock on tests
|
|
|
|
factory.VerifyAll();
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.Create``1(System.Object[])">
|
|
<summary>
|
|
Creates a new mock with the default <see cref="T:Moq.MockBehavior"/>
|
|
specified at factory construction time and with the
|
|
the given constructor arguments for the class.
|
|
</summary>
|
|
<remarks>
|
|
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.
|
|
</remarks>
|
|
<typeparam name="T">Type to mock.</typeparam>
|
|
<param name="args">Constructor arguments for mocked classes.</param>
|
|
<returns>A new <see cref="T:Moq.Mock`1"/>.</returns>
|
|
<example ignore="true">
|
|
<code>
|
|
var factory = new MockFactory(MockBehavior.Default);
|
|
|
|
var mock = factory.Create<MyBase>("Foo", 25, true);
|
|
// use mock on tests
|
|
|
|
factory.Verify();
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.Create``1(Moq.MockBehavior)">
|
|
<summary>
|
|
Creates a new mock with the given <paramref name="behavior"/>.
|
|
</summary>
|
|
<typeparam name="T">Type to mock.</typeparam>
|
|
<param name="behavior">Behavior to use for the mock, which overrides
|
|
the default behavior specified at factory construction time.</param>
|
|
<returns>A new <see cref="T:Moq.Mock`1"/>.</returns>
|
|
<example group="factory">
|
|
The following example shows how to create a mock with a different
|
|
behavior to that specified as the default for the factory:
|
|
<code>
|
|
var factory = new MockFactory(MockBehavior.Strict);
|
|
|
|
var foo = factory.Create<IFoo>(MockBehavior.Loose);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.Create``1(Moq.MockBehavior,System.Object[])">
|
|
<summary>
|
|
Creates a new mock with the given <paramref name="behavior"/>
|
|
and with the the given constructor arguments for the class.
|
|
</summary>
|
|
<remarks>
|
|
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.
|
|
</remarks>
|
|
<typeparam name="T">Type to mock.</typeparam>
|
|
<param name="behavior">Behavior to use for the mock, which overrides
|
|
the default behavior specified at factory construction time.</param>
|
|
<param name="args">Constructor arguments for mocked classes.</param>
|
|
<returns>A new <see cref="T:Moq.Mock`1"/>.</returns>
|
|
<example group="factory">
|
|
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:
|
|
<code>
|
|
var factory = new MockFactory(MockBehavior.Default);
|
|
|
|
var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.CreateMock``1(Moq.MockBehavior,System.Object[])">
|
|
<summary>
|
|
Implements creation of a new mock within the factory.
|
|
</summary>
|
|
<typeparam name="T">Type to mock.</typeparam>
|
|
<param name="behavior">The behavior for the new mock.</param>
|
|
<param name="args">Optional arguments for the construction of the mock.</param>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.Verify">
|
|
<summary>
|
|
Verifies all verifiable expectations on all mocks created
|
|
by this factory.
|
|
</summary>
|
|
<seealso cref="M:Moq.Mock.Verify"/>
|
|
<exception cref="T:Moq.MockException">One or more mocks had expectations that were not satisfied.</exception>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.VerifyAll">
|
|
<summary>
|
|
Verifies all verifiable expectations on all mocks created
|
|
by this factory.
|
|
</summary>
|
|
<seealso cref="M:Moq.Mock.Verify"/>
|
|
<exception cref="T:Moq.MockException">One or more mocks had expectations that were not satisfied.</exception>
|
|
</member>
|
|
<member name="M:Moq.MockFactory.VerifyMocks(System.Action{Moq.Mock})">
|
|
<summary>
|
|
Invokes <paramref name="verifyAction"/> for each mock
|
|
in <see cref="P:Moq.MockFactory.Mocks"/>, and accumulates the resulting
|
|
<see cref="T:Moq.MockVerificationException"/> that might be
|
|
thrown from the action.
|
|
</summary>
|
|
<param name="verifyAction">The action to execute against
|
|
each mock.</param>
|
|
</member>
|
|
<member name="P:Moq.MockFactory.CallBase">
|
|
<summary>
|
|
Whether the base member virtual implementation will be called
|
|
for mocked classes if no setup is matched. Defaults to <see langword="false"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.MockFactory.DefaultValue">
|
|
<summary>
|
|
Specifies the behavior to use when returning default values for
|
|
unexpected invocations on loose mocks.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.MockFactory.Mocks">
|
|
<summary>
|
|
Gets the mocks that have been created by this factory and
|
|
that will get verified together.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Properties.Resources">
|
|
<summary>
|
|
A strongly-typed resource class, for looking up localized strings, etc.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.ResourceManager">
|
|
<summary>
|
|
Returns the cached ResourceManager instance used by this class.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.Culture">
|
|
<summary>
|
|
Overrides the current thread's CurrentUICulture property for all
|
|
resource lookups using this strongly typed resource class.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.AlreadyInitialized">
|
|
<summary>
|
|
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..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.ArgumentCannotBeEmpty">
|
|
<summary>
|
|
Looks up a localized string similar to Value cannot be an empty string..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.AsMustBeInterface">
|
|
<summary>
|
|
Looks up a localized string similar to Can only add interfaces to the mock..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.CantSetReturnValueForVoid">
|
|
<summary>
|
|
Looks up a localized string similar to Can't set return value for void method {0}..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.ConstructorArgsForInterface">
|
|
<summary>
|
|
Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.ConstructorNotFound">
|
|
<summary>
|
|
Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.FieldsNotSupported">
|
|
<summary>
|
|
Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.InvalidMockClass">
|
|
<summary>
|
|
Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. .
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.InvalidMockGetType">
|
|
<summary>
|
|
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..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.MemberMissing">
|
|
<summary>
|
|
Looks up a localized string similar to Member {0}.{1} does not exist..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.MethodIsPublic">
|
|
<summary>
|
|
Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead:
|
|
mock.Setup(x => x.{1}());
|
|
.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.MockExceptionMessage">
|
|
<summary>
|
|
Looks up a localized string similar to {0} invocation failed with mock behavior {1}.
|
|
{2}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.MoreThanNCalls">
|
|
<summary>
|
|
Looks up a localized string similar to Expected only {0} calls to {1}..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.MoreThanOneCall">
|
|
<summary>
|
|
Looks up a localized string similar to Expected only one call to {0}..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsAtLeast">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock at least {2} times, but was {4} times: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsAtLeastOnce">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock at least once, but was never performed: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsAtMost">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock at most {3} times, but was {4} times: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsAtMostOnce">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock at most once, but was {4} times: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsBetweenExclusive">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsBetweenInclusive">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsExactly">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock exactly {2} times, but was {4} times: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsNever">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock should never have been performed, but was {4} times: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoMatchingCallsOnce">
|
|
<summary>
|
|
Looks up a localized string similar to {0}
|
|
Expected invocation on the mock once, but was {4} times: {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.NoSetup">
|
|
<summary>
|
|
Looks up a localized string similar to All invocations on the mock must have a corresponding setup..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.ObjectInstanceNotMock">
|
|
<summary>
|
|
Looks up a localized string similar to Object instance was not created by Moq..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.PropertyMissing">
|
|
<summary>
|
|
Looks up a localized string similar to Property {0}.{1} does not exist..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.PropertyNotReadable">
|
|
<summary>
|
|
Looks up a localized string similar to Property {0}.{1} is write-only..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.PropertyNotWritable">
|
|
<summary>
|
|
Looks up a localized string similar to Property {0}.{1} is read-only..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.RaisedUnassociatedEvent">
|
|
<summary>
|
|
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..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.ReturnValueRequired">
|
|
<summary>
|
|
Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.SetupLambda">
|
|
<summary>
|
|
Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.SetupNever">
|
|
<summary>
|
|
Looks up a localized string similar to Invocation {0} should not have been made..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.SetupNotMethod">
|
|
<summary>
|
|
Looks up a localized string similar to Expression is not a method invocation: {0}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.SetupNotProperty">
|
|
<summary>
|
|
Looks up a localized string similar to Expression is not a property access: {0}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.SetupNotSetter">
|
|
<summary>
|
|
Looks up a localized string similar to Expression is not a property setter invocation..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.SetupOnNonMemberMethod">
|
|
<summary>
|
|
Looks up a localized string similar to Invalid setup on a non-member method:
|
|
{0}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.SetupOnNonOverridableMember">
|
|
<summary>
|
|
Looks up a localized string similar to Invalid setup on a non-overridable member:
|
|
{0}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.TypeNotImplementInterface">
|
|
<summary>
|
|
Looks up a localized string similar to Type {0} does not implement required interface {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.TypeNotInheritFromType">
|
|
<summary>
|
|
Looks up a localized string similar to Type {0} does not from required type {1}.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.UnexpectedPublicProperty">
|
|
<summary>
|
|
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);
|
|
.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.UnsupportedExpression">
|
|
<summary>
|
|
Looks up a localized string similar to Expression {0} is not supported..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.UnsupportedIntermediateExpression">
|
|
<summary>
|
|
Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.UnsupportedIntermediateType">
|
|
<summary>
|
|
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}..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.UnsupportedMatcherParamsForSetter">
|
|
<summary>
|
|
Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.UnsupportedMember">
|
|
<summary>
|
|
Looks up a localized string similar to Member {0} is not supported for protected mocking..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.UnsupportedNonStaticMatcherForSetter">
|
|
<summary>
|
|
Looks up a localized string similar to Setter expression can only use static custom matchers..
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.UnsupportedProtectedProperty">
|
|
<summary>
|
|
Looks up a localized string similar to To specify a setup for protected property {0}.{1}, use:
|
|
mock.Setup<{2}>(x => x.{1}).Returns(value);
|
|
mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one
|
|
mock.SetupSet(x => x.{1}).Callback(callbackDelegate);.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Properties.Resources.VerficationFailed">
|
|
<summary>
|
|
Looks up a localized string similar to The following setups were not matched:
|
|
{0}.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Protected.IProtectedMock`1">
|
|
<summary>
|
|
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.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Protected.IProtectedMock`1.Setup(System.String,System.Object[])">
|
|
<summary>
|
|
Specifies a setup for a void method invocation with the given
|
|
<paramref name="voidMethodName"/>, optionally specifying
|
|
arguments for the method call.
|
|
</summary>
|
|
<param name="voidMethodName">Name of the void method to be invoke.</param>
|
|
<param name="args">Optional arguments for the invocation. If argument matchers are used,
|
|
remember to use <see cref="T:Moq.Protected.ItExpr"/> rather than <see cref="T:Moq.It"/>.</param>
|
|
</member>
|
|
<member name="M:Moq.Protected.IProtectedMock`1.Setup``1(System.String,System.Object[])">
|
|
<summary>
|
|
Specifies a setup for an invocation on a property or a non void method with the given
|
|
<paramref name="methodOrPropertyName"/>, optionally specifying
|
|
arguments for the method call.
|
|
</summary>
|
|
<param name="methodOrPropertyName">Name of the method or property to be invoke.</param>
|
|
<param name="args">Optional arguments for the invocation. If argument matchers are used,
|
|
remember to use <see cref="T:Moq.Protected.ItExpr"/> rather than <see cref="T:Moq.It"/>.</param>
|
|
<typeparam name="TResult">Return type of the method or property.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Protected.IProtectedMock`1.SetupGet``1(System.String)">
|
|
<summary>
|
|
Specifies a setup for an invocation on a property getter with the given
|
|
<paramref name="propertyName"/>.
|
|
</summary>
|
|
<param name="propertyName">Name of the property.</param>
|
|
<typeparam name="TProperty">Type of the property.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Protected.IProtectedMock`1.SetupSet``1(System.String)">
|
|
<summary>
|
|
Specifies a setup for an invocation on a property setter with the given
|
|
<paramref name="propertyName"/>.
|
|
</summary>
|
|
<param name="propertyName">Name of the property.</param>
|
|
<typeparam name="TProperty">Type of the property.</typeparam>
|
|
</member>
|
|
<member name="T:Moq.Protected.ItExpr">
|
|
<summary>
|
|
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.
|
|
</summary>
|
|
<remarks>
|
|
<para>Use this variant of argument matching instead of
|
|
<see cref="T:Moq.It"/> for protected setups.</para>
|
|
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.
|
|
</remarks>
|
|
</member>
|
|
<member name="M:Moq.Protected.ItExpr.IsNull``1">
|
|
<summary>
|
|
Matches a null value of the given <paramref name="TValue"/> type.
|
|
</summary>
|
|
<remarks>
|
|
Required for protected mocks as the null value cannot be used
|
|
directly as it prevents proper method overload selection.
|
|
</remarks>
|
|
<example>
|
|
<code>
|
|
// Throws an exception for a call to Remove with a null string value.
|
|
mock.Protected()
|
|
.Setup("Remove", ItExpr.IsNull<string>())
|
|
.Throws(new InvalidOperationException());
|
|
</code>
|
|
</example>
|
|
<typeparam name="TValue">Type of the value.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Protected.ItExpr.IsAny``1">
|
|
<summary>
|
|
Matches any value of the given <paramref name="TValue"/> type.
|
|
</summary>
|
|
<remarks>
|
|
Typically used when the actual argument value for a method
|
|
call is not relevant.
|
|
</remarks>
|
|
<example>
|
|
<code>
|
|
// Throws an exception for a call to Remove with any string value.
|
|
mock.Protected()
|
|
.Setup("Remove", ItExpr.IsAny<string>())
|
|
.Throws(new InvalidOperationException());
|
|
</code>
|
|
</example>
|
|
<typeparam name="TValue">Type of the value.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Protected.ItExpr.Is``1(System.Linq.Expressions.Expression{System.Predicate{``0}})">
|
|
<summary>
|
|
Matches any value that satisfies the given predicate.
|
|
</summary>
|
|
<typeparam name="TValue">Type of the argument to check.</typeparam>
|
|
<param name="match">The predicate used to match the method argument.</param>
|
|
<remarks>
|
|
Allows the specification of a predicate to perform matching
|
|
of method call arguments.
|
|
</remarks>
|
|
<example>
|
|
This example shows how to return the value <c>1</c> whenever the argument to the
|
|
<c>Do</c> method is an even number.
|
|
<code>
|
|
mock.Protected()
|
|
.Setup("Do", ItExpr.Is<int>(i => i % 2 == 0))
|
|
.Returns(1);
|
|
</code>
|
|
This example shows how to throw an exception if the argument to the
|
|
method is a negative number:
|
|
<code>
|
|
mock.Protected()
|
|
.Setup("GetUser", ItExpr.Is<int>(i => i < 0))
|
|
.Throws(new ArgumentException());
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Protected.ItExpr.IsInRange``1(``0,``0,Moq.Range)">
|
|
<summary>
|
|
Matches any value that is in the range specified.
|
|
</summary>
|
|
<typeparam name="TValue">Type of the argument to check.</typeparam>
|
|
<param name="from">The lower bound of the range.</param>
|
|
<param name="to">The upper bound of the range.</param>
|
|
<param name="rangeKind">The kind of range. See <see cref="T:Moq.Range"/>.</param>
|
|
<example>
|
|
The following example shows how to expect a method call
|
|
with an integer argument within the 0..100 range.
|
|
<code>
|
|
mock.Protected()
|
|
.Setup("HasInventory",
|
|
ItExpr.IsAny<string>(),
|
|
ItExpr.IsInRange(0, 100, Range.Inclusive))
|
|
.Returns(false);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Protected.ItExpr.IsRegex(System.String)">
|
|
<summary>
|
|
Matches a string argument if it matches the given regular expression pattern.
|
|
</summary>
|
|
<param name="regex">The pattern to use to match the string argument value.</param>
|
|
<example>
|
|
The following example shows how to expect a call to a method where the
|
|
string argument matches the given regular expression:
|
|
<code>
|
|
mock.Protected()
|
|
.Setup("Check", ItExpr.IsRegex("[a-z]+"))
|
|
.Returns(1);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Protected.ItExpr.IsRegex(System.String,System.Text.RegularExpressions.RegexOptions)">
|
|
<summary>
|
|
Matches a string argument if it matches the given regular expression pattern.
|
|
</summary>
|
|
<param name="regex">The pattern to use to match the string argument value.</param>
|
|
<param name="options">The options used to interpret the pattern.</param>
|
|
<example>
|
|
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:
|
|
<code>
|
|
mock.Protected()
|
|
.Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase))
|
|
.Returns(1);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="T:Moq.Protected.ProtectedExtension">
|
|
<summary>
|
|
Enables the <c>Protected()</c> method on <see cref="T:Moq.Mock`1"/>,
|
|
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.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Protected.ProtectedExtension.Protected``1(Moq.Mock{``0})">
|
|
<summary>
|
|
Enable protected setups for the mock.
|
|
</summary>
|
|
<typeparam name="T">Mocked object type. Typically omitted as it can be inferred from the mock instance.</typeparam>
|
|
<param name="mock">The mock to set the protected setups on.</param>
|
|
</member>
|
|
<member name="T:ThisAssembly">
|
|
<group name="overview" title="Overview" order="0" />
|
|
<group name="setups" title="Specifying setups" order="1" />
|
|
<group name="returns" title="Returning values from members" order="2" />
|
|
<group name="verification" title="Verifying setups" order="3" />
|
|
<group name="advanced" title="Advanced scenarios" order="99" />
|
|
<group name="factory" title="Using MockFactory for consistency across mocks" order="4" />
|
|
</member>
|
|
<member name="T:Moq.Range">
|
|
<summary>
|
|
Kind of range to use in a filter specified through
|
|
<see cref="M:Moq.It.IsInRange``1(``0,``0,Moq.Range)"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="F:Moq.Range.Inclusive">
|
|
<summary>
|
|
The range includes the <c>to</c> and
|
|
<c>from</c> values.
|
|
</summary>
|
|
</member>
|
|
<member name="F:Moq.Range.Exclusive">
|
|
<summary>
|
|
The range does not include the <c>to</c> and
|
|
<c>from</c> values.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Mock`1">
|
|
<summary>
|
|
Provides a mock implementation of <typeparamref name="T"/>.
|
|
</summary><remarks>
|
|
Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked.
|
|
<para>
|
|
The behavior of the mock with regards to the setups and the actual calls is determined
|
|
by the optional <see cref="T:Moq.MockBehavior"/> that can be passed to the <see cref="M:Moq.Mock`1.#ctor(Moq.MockBehavior)"/>
|
|
constructor.
|
|
</para>
|
|
</remarks><typeparam name="T">Type to mock, which can be an interface or a class.</typeparam><example group="overview" order="0">
|
|
The following example shows establishing setups with specific values
|
|
for method invocations:
|
|
<code>
|
|
// 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);
|
|
</code>
|
|
The following example shows how to use the <see cref="T:Moq.It"/> class
|
|
to specify conditions for arguments instead of specific values:
|
|
<code>
|
|
// 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);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.#ctor(System.Boolean)">
|
|
<summary>
|
|
Ctor invoked by AsTInterface exclusively.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.#ctor">
|
|
<summary>
|
|
Initializes an instance of the mock with <see cref="F:Moq.MockBehavior.Default">default behavior</see>.
|
|
</summary><example>
|
|
<code>var mock = new Mock<IFormatProvider>();</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.#ctor(System.Object[])">
|
|
<summary>
|
|
Initializes an instance of the mock with <see cref="F:Moq.MockBehavior.Default">default behavior</see> and with
|
|
the given constructor arguments for the class. (Only valid when <typeparamref name="T"/> is a class)
|
|
</summary><remarks>
|
|
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.
|
|
</remarks><example>
|
|
<code>var mock = new Mock<MyProvider>(someArgument, 25);</code>
|
|
</example><param name="args">Optional constructor arguments if the mocked type is a class.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.#ctor(Moq.MockBehavior)">
|
|
<summary>
|
|
Initializes an instance of the mock with the specified <see cref="T:Moq.MockBehavior">behavior</see>.
|
|
</summary><example>
|
|
<code>var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed);</code>
|
|
</example><param name="behavior">Behavior of the mock.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.#ctor(Moq.MockBehavior,System.Object[])">
|
|
<summary>
|
|
Initializes an instance of the mock with a specific <see cref="T:Moq.MockBehavior">behavior</see> with
|
|
the given constructor arguments for the class.
|
|
</summary><remarks>
|
|
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.
|
|
</remarks><example>
|
|
<code>var mock = new Mock<MyProvider>(someArgument, 25);</code>
|
|
</example><param name="behavior">Behavior of the mock.</param><param name="args">Optional constructor arguments if the mocked type is a class.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.OnGetObject">
|
|
<summary>
|
|
Returns the mocked object value.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Setup(System.Linq.Expressions.Expression{System.Action{`0}})">
|
|
<summary>
|
|
Specifies a setup on the mocked type for a call to
|
|
to a void method.
|
|
</summary><remarks>
|
|
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.
|
|
</remarks><param name="expression">Lambda expression that specifies the expected method invocation.</param><example group="setups">
|
|
<code>
|
|
var mock = new Mock<IProcessor>();
|
|
mock.Setup(x => x.Execute("ping"));
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Setup``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
|
<summary>
|
|
Specifies a setup on the mocked type for a call to
|
|
to a value returning method.
|
|
</summary><typeparam name="TResult">Type of the return value. Typically omitted as it can be inferred from the expression.</typeparam><remarks>
|
|
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.
|
|
</remarks><param name="expression">Lambda expression that specifies the method invocation.</param><example group="setups">
|
|
<code>
|
|
mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.SetupGet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
|
<summary>
|
|
Specifies a setup on the mocked type for a call to
|
|
to a property getter.
|
|
</summary><remarks>
|
|
If more than one setup is set for the same property getter,
|
|
the latest one wins and is the one that will be executed.
|
|
</remarks><typeparam name="TProperty">Type of the property. Typically omitted as it can be inferred from the expression.</typeparam><param name="expression">Lambda expression that specifies the property getter.</param><example group="setups">
|
|
<code>
|
|
mock.SetupGet(x => x.Suspended)
|
|
.Returns(true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.SetupSet``1(System.Action{`0})">
|
|
<summary>
|
|
Specifies a setup on the mocked type for a call to
|
|
to a property setter.
|
|
</summary><remarks>
|
|
If more than one setup is set for the same property setter,
|
|
the latest one wins and is the one that will be executed.
|
|
<para>
|
|
This overloads allows the use of a callback already
|
|
typed for the property type.
|
|
</para>
|
|
</remarks><typeparam name="TProperty">Type of the property. Typically omitted as it can be inferred from the expression.</typeparam><param name="setterExpression">Lambda expression that sets a property to a value.</param><example group="setups">
|
|
<code>
|
|
mock.SetupSet(x => x.Suspended = true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.SetupSet(System.Action{`0})">
|
|
<summary>
|
|
Specifies a setup on the mocked type for a call to
|
|
to a property setter.
|
|
</summary><remarks>
|
|
If more than one setup is set for the same property setter,
|
|
the latest one wins and is the one that will be executed.
|
|
</remarks><param name="setterExpression">Lambda expression that sets a property to a value.</param><example group="setups">
|
|
<code>
|
|
mock.SetupSet(x => x.Suspended = true);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.SetupProperty``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
|
<summary>
|
|
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").
|
|
</summary><typeparam name="TProperty">
|
|
Type of the property, inferred from the property
|
|
expression (does not need to be specified).
|
|
</typeparam><param name="property">Property expression to stub.</param><example>
|
|
If you have an interface with an int property <c>Value</c>, you might
|
|
stub it using the following straightforward call:
|
|
<code>
|
|
var mock = new Mock<IHaveValue>();
|
|
mock.Stub(v => v.Value);
|
|
</code>
|
|
After the <c>Stub</c> call has been issued, setting and
|
|
retrieving the object value will behave as expected:
|
|
<code>
|
|
IHaveValue v = mock.Object;
|
|
|
|
v.Value = 5;
|
|
Assert.Equal(5, v.Value);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.SetupProperty``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},``0)">
|
|
<summary>
|
|
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").
|
|
</summary><typeparam name="TProperty">
|
|
Type of the property, inferred from the property
|
|
expression (does not need to be specified).
|
|
</typeparam><param name="property">Property expression to stub.</param><param name="initialValue">Initial value for the property.</param><example>
|
|
If you have an interface with an int property <c>Value</c>, you might
|
|
stub it using the following straightforward call:
|
|
<code>
|
|
var mock = new Mock<IHaveValue>();
|
|
mock.SetupProperty(v => v.Value, 5);
|
|
</code>
|
|
After the <c>SetupProperty</c> call has been issued, setting and
|
|
retrieving the object value will behave as expected:
|
|
<code>
|
|
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);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.SetupAllProperties">
|
|
<summary>
|
|
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 <see cref="P:Moq.Mock.DefaultValue"/> property for the mock.
|
|
</summary><remarks>
|
|
If the mock <see cref="P:Moq.Mock.DefaultValue"/> is set to <see cref="F:Moq.DefaultValue.Mock"/>,
|
|
the mocked default values will also get all properties setup recursively.
|
|
</remarks>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Verify(System.Linq.Expressions.Expression{System.Action{`0}})">
|
|
<summary>
|
|
Verifies that a specific invocation matching the given expression was performed on the mock. Use
|
|
in conjuntion with the default <see cref="F:Moq.MockBehavior.Loose"/>.
|
|
</summary><example group="verification">
|
|
This example assumes that the mock has been used, and later we want to verify that a given
|
|
invocation with specific parameters was performed:
|
|
<code>
|
|
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"));
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception><param name="expression">Expression to verify.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Verify(System.Linq.Expressions.Expression{System.Action{`0}},Moq.Times)">
|
|
<summary>
|
|
Verifies that a specific invocation matching the given expression was performed on the mock. Use
|
|
in conjuntion with the default <see cref="F:Moq.MockBehavior.Loose"/>.
|
|
</summary><exception cref="T:Moq.MockException">
|
|
The invocation was not call the times specified by
|
|
<paramref name="times"/>.
|
|
</exception><param name="expression">Expression to verify.</param><param name="times">The number of times a method is allowed to be called.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Verify(System.Linq.Expressions.Expression{System.Action{`0}},System.String)">
|
|
<summary>
|
|
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
|
|
<see cref="F:Moq.MockBehavior.Loose"/>.
|
|
</summary><example group="verification">
|
|
This example assumes that the mock has been used, and later we want to verify that a given
|
|
invocation with specific parameters was performed:
|
|
<code>
|
|
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"));
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception><param name="expression">Expression to verify.</param><param name="failMessage">Message to show if verification fails.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Verify(System.Linq.Expressions.Expression{System.Action{`0}},Moq.Times,System.String)">
|
|
<summary>
|
|
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
|
|
<see cref="F:Moq.MockBehavior.Loose"/>.
|
|
</summary><exception cref="T:Moq.MockException">
|
|
The invocation was not call the times specified by
|
|
<paramref name="times"/>.
|
|
</exception><param name="expression">Expression to verify.</param><param name="times">The number of times a method is allowed to be called.</param><param name="failMessage">Message to show if verification fails.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Verify``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
|
<summary>
|
|
Verifies that a specific invocation matching the given expression was performed on the mock. Use
|
|
in conjuntion with the default <see cref="F:Moq.MockBehavior.Loose"/>.
|
|
</summary><example group="verification">
|
|
This example assumes that the mock has been used, and later we want to verify that a given
|
|
invocation with specific parameters was performed:
|
|
<code>
|
|
var mock = new Mock<IWarehouse>();
|
|
// exercise mock
|
|
//...
|
|
// Will throw if the test code didn't call HasInventory.
|
|
mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50));
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception><param name="expression">Expression to verify.</param><typeparam name="TResult">Type of return value from the expression.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Verify``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},Moq.Times)">
|
|
<summary>
|
|
Verifies that a specific invocation matching the given
|
|
expression was performed on the mock. Use in conjuntion
|
|
with the default <see cref="F:Moq.MockBehavior.Loose"/>.
|
|
</summary><exception cref="T:Moq.MockException">
|
|
The invocation was not call the times specified by
|
|
<paramref name="times"/>.
|
|
</exception><param name="expression">Expression to verify.</param><param name="times">The number of times a method is allowed to be called.</param><typeparam name="TResult">Type of return value from the expression.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Verify``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},System.String)">
|
|
<summary>
|
|
Verifies that a specific invocation matching the given
|
|
expression was performed on the mock, specifying a failure
|
|
error message.
|
|
</summary><example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given invocation
|
|
with specific parameters was performed:
|
|
<code>
|
|
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");
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception><param name="expression">Expression to verify.</param><param name="failMessage">Message to show if verification fails.</param><typeparam name="TResult">Type of return value from the expression.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Verify``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},Moq.Times,System.String)">
|
|
<summary>
|
|
Verifies that a specific invocation matching the given
|
|
expression was performed on the mock, specifying a failure
|
|
error message.
|
|
</summary><exception cref="T:Moq.MockException">
|
|
The invocation was not call the times specified by
|
|
<paramref name="times"/>.
|
|
</exception><param name="expression">Expression to verify.</param><param name="times">The number of times a method is allowed to be called.</param><param name="failMessage">Message to show if verification fails.</param><typeparam name="TResult">Type of return value from the expression.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.VerifyGet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
|
<summary>
|
|
Verifies that a property was read on the mock.
|
|
</summary><example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given property
|
|
was retrieved from it:
|
|
<code>
|
|
var mock = new Mock<IWarehouse>();
|
|
// exercise mock
|
|
//...
|
|
// Will throw if the test code didn't retrieve the IsClosed property.
|
|
mock.VerifyGet(warehouse => warehouse.IsClosed);
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception><param name="expression">Expression to verify.</param><typeparam name="TProperty">
|
|
Type of the property to verify. Typically omitted as it can
|
|
be inferred from the expression's return type.
|
|
</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.VerifyGet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},Moq.Times)">
|
|
<summary>
|
|
Verifies that a property was read on the mock.
|
|
</summary><exception cref="T:Moq.MockException">
|
|
The invocation was not call the times specified by
|
|
<paramref name="times"/>.
|
|
</exception><param name="times">The number of times a method is allowed to be called.</param><param name="expression">Expression to verify.</param><typeparam name="TProperty">
|
|
Type of the property to verify. Typically omitted as it can
|
|
be inferred from the expression's return type.
|
|
</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.VerifyGet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},System.String)">
|
|
<summary>
|
|
Verifies that a property was read on the mock, specifying a failure
|
|
error message.
|
|
</summary><example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given property
|
|
was retrieved from it:
|
|
<code>
|
|
var mock = new Mock<IWarehouse>();
|
|
// exercise mock
|
|
//...
|
|
// Will throw if the test code didn't retrieve the IsClosed property.
|
|
mock.VerifyGet(warehouse => warehouse.IsClosed);
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception><param name="expression">Expression to verify.</param><param name="failMessage">Message to show if verification fails.</param><typeparam name="TProperty">
|
|
Type of the property to verify. Typically omitted as it can
|
|
be inferred from the expression's return type.
|
|
</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.VerifyGet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},Moq.Times,System.String)">
|
|
<summary>
|
|
Verifies that a property was read on the mock, specifying a failure
|
|
error message.
|
|
</summary><exception cref="T:Moq.MockException">
|
|
The invocation was not call the times specified by
|
|
<paramref name="times"/>.
|
|
</exception><param name="times">The number of times a method is allowed to be called.</param><param name="expression">Expression to verify.</param><param name="failMessage">Message to show if verification fails.</param><typeparam name="TProperty">
|
|
Type of the property to verify. Typically omitted as it can
|
|
be inferred from the expression's return type.
|
|
</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.VerifySet(System.Action{`0})">
|
|
<summary>
|
|
Verifies that a property was set on the mock.
|
|
</summary><example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given property
|
|
was set on it:
|
|
<code>
|
|
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);
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception><param name="setterExpression">Expression to verify.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.VerifySet(System.Action{`0},Moq.Times)">
|
|
<summary>
|
|
Verifies that a property was set on the mock.
|
|
</summary><exception cref="T:Moq.MockException">
|
|
The invocation was not call the times specified by
|
|
<paramref name="times"/>.
|
|
</exception><param name="times">The number of times a method is allowed to be called.</param><param name="setterExpression">Expression to verify.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.VerifySet(System.Action{`0},System.String)">
|
|
<summary>
|
|
Verifies that a property was set on the mock, specifying
|
|
a failure message.
|
|
</summary><example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given property
|
|
was set on it:
|
|
<code>
|
|
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");
|
|
</code>
|
|
</example><exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception><param name="setterExpression">Expression to verify.</param><param name="failMessage">Message to show if verification fails.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.VerifySet(System.Action{`0},Moq.Times,System.String)">
|
|
<summary>
|
|
Verifies that a property was set on the mock, specifying
|
|
a failure message.
|
|
</summary><exception cref="T:Moq.MockException">
|
|
The invocation was not call the times specified by
|
|
<paramref name="times"/>.
|
|
</exception><param name="times">The number of times a method is allowed to be called.</param><param name="setterExpression">Expression to verify.</param><param name="failMessage">Message to show if verification fails.</param>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Raise(System.Action{`0},System.EventArgs)">
|
|
<summary>
|
|
Raises the event referenced in <paramref name="eventExpression"/> using
|
|
the given <paramref name="sender"/> and <paramref name="args"/> arguments.
|
|
</summary><exception cref="T:System.ArgumentException">
|
|
The <paramref name="args"/> argument is
|
|
invalid for the target event invocation, or the <paramref name="eventExpression"/> is
|
|
not an event attach or detach expression.
|
|
</exception><example>
|
|
The following example shows how to raise a <see cref="E:System.ComponentModel.INotifyPropertyChanged.PropertyChanged"/> event:
|
|
<code>
|
|
var mock = new Mock<IViewModel>();
|
|
|
|
mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name"));
|
|
</code>
|
|
</example><example>
|
|
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:
|
|
<code>
|
|
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);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Raise(System.Action{`0},System.Object[])">
|
|
<summary>
|
|
Raises the event referenced in <paramref name="eventExpression"/> using
|
|
the given <paramref name="sender"/> and <paramref name="args"/> arguments
|
|
for a non-EventHandler typed event.
|
|
</summary><exception cref="T:System.ArgumentException">
|
|
The <paramref name="args"/> arguments are
|
|
invalid for the target event invocation, or the <paramref name="eventExpression"/> is
|
|
not an event attach or detach expression.
|
|
</exception><example>
|
|
The following example shows how to raise a custom event that does not adhere to
|
|
the standard <c>EventHandler</c>:
|
|
<code>
|
|
var mock = new Mock<IViewModel>();
|
|
|
|
mock.Raise(x => x.MyEvent -= null, "Name", bool, 25);
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Expect(System.Linq.Expressions.Expression{System.Action{`0}})">
|
|
<summary>
|
|
Obsolete.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.Expect``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
|
<summary>
|
|
Obsolete.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.ExpectGet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
|
<summary>
|
|
Obsolete.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.ExpectSet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})">
|
|
<summary>
|
|
Obsolete.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mock`1.ExpectSet``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},``0)">
|
|
<summary>
|
|
Obsolete.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.Mock`1.Object">
|
|
<summary>
|
|
Exposes the mocked object instance.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.DefaultValue">
|
|
<summary>
|
|
Determines the way default values are generated
|
|
calculated for loose mocks.
|
|
</summary>
|
|
</member>
|
|
<member name="F:Moq.DefaultValue.Empty">
|
|
<summary>
|
|
Default behavior, which generates empty values for
|
|
value types (i.e. default(int)), empty array and
|
|
enumerables, and nulls for all other reference types.
|
|
</summary>
|
|
</member>
|
|
<member name="F:Moq.DefaultValue.Mock">
|
|
<summary>
|
|
Whenever the default value generated by <see cref="F:Moq.DefaultValue.Empty"/>
|
|
is null, replaces this value with a mock (if the type
|
|
can be mocked).
|
|
</summary>
|
|
<remarks>
|
|
For sealed classes, a null value will be generated.
|
|
</remarks>
|
|
</member>
|
|
<member name="T:IQToolkit.ExpressionReplacer">
|
|
<summary>
|
|
Replaces references to one specific instance of an expression node with another node
|
|
</summary>
|
|
</member>
|
|
<member name="T:IQToolkit.Query`1">
|
|
<summary>
|
|
A default implementation of IQueryable for use with QueryProvider
|
|
</summary>
|
|
</member>
|
|
<member name="T:IQToolkit.QueryProvider">
|
|
<summary>
|
|
A basic abstract LINQ query provider
|
|
</summary>
|
|
</member>
|
|
<member name="T:IQToolkit.TypeHelper">
|
|
<summary>
|
|
Type related helper methods
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Match">
|
|
<summary>
|
|
Allows creation custom value matchers that can be used on setups and verification,
|
|
completely replacing the built-in <see cref="T:Moq.It"/> class with your own argument
|
|
matching rules.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Match.Matcher``1">
|
|
<devdoc>
|
|
Provided for the sole purpose of rendering the delegate passed to the
|
|
matcher constructor if no friendly render lambda is provided.
|
|
</devdoc>
|
|
</member>
|
|
<member name="T:Moq.Match`1">
|
|
<summary>
|
|
Allows creation custom value matchers that can be used on setups and verification,
|
|
completely replacing the built-in <see cref="T:Moq.It"/> class with your own argument
|
|
matching rules.
|
|
</summary><typeparam name="T">Type of the value to match.</typeparam><remarks>
|
|
The argument matching is used to determine whether a concrete
|
|
invocation in the mock matches a given setup. This
|
|
matching mechanism is fully extensible.
|
|
</remarks><example>
|
|
Creating a custom matcher is straightforward. You just need to create a method
|
|
that returns a value from a call to <see cref="M:Moq.Match`1.Create(System.Predicate{`0})"/> with
|
|
your matching condition and optional friendly render expression:
|
|
<code>
|
|
public Order IsBigOrder()
|
|
{
|
|
return Match<Order>.Create(
|
|
o => o.GrandTotal >= 5000,
|
|
/* a friendly expression to render on failures */
|
|
() => IsBigOrder());
|
|
}
|
|
</code>
|
|
This method can be used in any mock setup invocation:
|
|
<code>
|
|
mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>();
|
|
</code>
|
|
At runtime, Moq knows that the return value was a matcher and
|
|
evaluates your predicate with the actual value passed into your predicate.
|
|
<para>
|
|
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:
|
|
</para>
|
|
<code>
|
|
public static class Orders
|
|
{
|
|
public static IEnumerable<Order> Contains(Order order)
|
|
{
|
|
return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order));
|
|
}
|
|
}
|
|
</code>
|
|
Now we can invoke this static method instead of an argument in an
|
|
invocation:
|
|
<code>
|
|
var order = new Order { ... };
|
|
var mock = new Mock<IRepository<Order>>();
|
|
|
|
mock.Setup(x => x.Save(Orders.Contains(order)))
|
|
.Throws<ArgumentException>();
|
|
</code>
|
|
</example>
|
|
</member>
|
|
<member name="M:Moq.Match`1.Create(System.Predicate{`0})">
|
|
<summary>
|
|
Initializes the match with the condition that
|
|
will be checked in order to match invocation
|
|
values.
|
|
</summary><param name="condition">The condition to match against actual values.</param><remarks>
|
|
<seealso cref="T:Moq.Match`1"/>
|
|
</remarks>
|
|
</member>
|
|
<member name="M:Moq.Match`1.Create(System.Predicate{`0},System.Linq.Expressions.Expression{System.Func{`0}})">
|
|
<!-- No matching elements were found for the following include tag --><include file="Match.xdoc" path="docs/doc[@for="Match{T}.Create(condition,renderExpression"]/*"/>
|
|
</member>
|
|
<member name="M:Moq.Match`1.Convert">
|
|
<!-- No matching elements were found for the following include tag --><include file="Match.xdoc" path="docs/doc[@for="Match{T}.Convert"]/*"/>
|
|
</member>
|
|
<member name="M:Moq.Match`1.SetLastMatch``1(Moq.Match{``0})">
|
|
<devdoc>
|
|
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.
|
|
</devdoc>
|
|
</member>
|
|
<member name="T:Moq.MockLegacyExtensions">
|
|
<summary>
|
|
Provides legacy API members as extensions so that
|
|
existing code continues to compile, but new code
|
|
doesn't see then.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.MockLegacyExtensions.SetupSet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)">
|
|
<summary>
|
|
Obsolete.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.MockLegacyExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)">
|
|
<summary>
|
|
Obsolete.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.MockLegacyExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)">
|
|
<summary>
|
|
Obsolete.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.FluentMockContext">
|
|
<summary>
|
|
Tracks the current mock and interception context.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Moq.FluentMockContext.IsActive">
|
|
<summary>
|
|
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.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MockDefaultValueProvider">
|
|
<summary>
|
|
A <see cref="T:Moq.IDefaultValueProvider"/> 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.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MockedEvent`1">
|
|
<summary>
|
|
Provides a typed <see cref="T:Moq.MockedEvent"/> for a
|
|
specific type of <see cref="T:System.EventArgs"/>.
|
|
</summary>
|
|
<typeparam name="TEventArgs">The type of event arguments required by the event.</typeparam>
|
|
<remarks>
|
|
The mocked event can either be a <see cref="T:System.EventHandler`1"/> or custom
|
|
event handler which follows .NET practice of providing <c>object sender, EventArgs args</c>
|
|
kind of signature.
|
|
</remarks>
|
|
</member>
|
|
<member name="M:Moq.MockedEvent`1.Raise(`0)">
|
|
<summary>
|
|
Raises the associated event with the given
|
|
event argument data.
|
|
</summary>
|
|
<param name="args">Data to pass to the event.</param>
|
|
</member>
|
|
<member name="M:Moq.MockedEvent`1.op_Implicit(Moq.MockedEvent{`0})~System.EventHandler{`0}">
|
|
<summary>
|
|
Provides support for attaching a <see cref="T:Moq.MockedEvent`1"/> to
|
|
a generic <see cref="T:System.EventHandler`1"/> event.
|
|
</summary>
|
|
<param name="mockEvent">Event to convert.</param>
|
|
</member>
|
|
<member name="M:Moq.MockedEvent`1.Handle(System.Object,`0)">
|
|
<summary>
|
|
Provided solely to allow the interceptor to determine when the attached
|
|
handler is coming from this mocked event so we can assign the
|
|
corresponding EventInfo for it.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.MockExtensions">
|
|
<summary>
|
|
Provides additional methods on mocks.
|
|
</summary>
|
|
<devdoc>
|
|
Provided as extension methods as they confuse the compiler
|
|
with the overloads taking Action.
|
|
</devdoc>
|
|
</member>
|
|
<member name="M:Moq.MockExtensions.SetupSet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}})">
|
|
<summary>
|
|
Specifies a setup on the mocked type for a call to
|
|
to a property setter, regardless of its value.
|
|
</summary>
|
|
<remarks>
|
|
If more than one setup is set for the same property setter,
|
|
the latest one wins and is the one that will be executed.
|
|
</remarks>
|
|
<typeparam name="TProperty">Type of the property. Typically omitted as it can be inferred from the expression.</typeparam>
|
|
<typeparam name="T">Type of the mock.</typeparam>
|
|
<param name="mock">The target mock for the setup.</param>
|
|
<param name="expression">Lambda expression that specifies the property setter.</param>
|
|
<example group="setups">
|
|
<code>
|
|
mock.SetupSet(x => x.Suspended);
|
|
</code>
|
|
</example>
|
|
<devdoc>
|
|
This method is not legacy, but must be on an extension method to avoid
|
|
confusing the compiler with the new Action syntax.
|
|
</devdoc>
|
|
</member>
|
|
<member name="M:Moq.MockExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}})">
|
|
<summary>
|
|
Verifies that a property has been set on the mock, regarless of its value.
|
|
</summary>
|
|
<example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given invocation
|
|
with specific parameters was performed:
|
|
<code>
|
|
var mock = new Mock<IWarehouse>();
|
|
// exercise mock
|
|
//...
|
|
// Will throw if the test code didn't set the IsClosed property.
|
|
mock.VerifySet(warehouse => warehouse.IsClosed);
|
|
</code>
|
|
</example>
|
|
<exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception>
|
|
<param name="expression">Expression to verify.</param>
|
|
<param name="mock">The mock instance.</param>
|
|
<typeparam name="T">Mocked type.</typeparam>
|
|
<typeparam name="TProperty">Type of the property to verify. Typically omitted as it can
|
|
be inferred from the expression's return type.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.MockExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
|
|
<summary>
|
|
Verifies that a property has been set on the mock, specifying a failure
|
|
error message.
|
|
</summary>
|
|
<example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given invocation
|
|
with specific parameters was performed:
|
|
<code>
|
|
var mock = new Mock<IWarehouse>();
|
|
// exercise mock
|
|
//...
|
|
// Will throw if the test code didn't set the IsClosed property.
|
|
mock.VerifySet(warehouse => warehouse.IsClosed);
|
|
</code>
|
|
</example>
|
|
<exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception>
|
|
<param name="expression">Expression to verify.</param>
|
|
<param name="failMessage">Message to show if verification fails.</param>
|
|
<param name="mock">The mock instance.</param>
|
|
<typeparam name="T">Mocked type.</typeparam>
|
|
<typeparam name="TProperty">Type of the property to verify. Typically omitted as it can
|
|
be inferred from the expression's return type.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.MockExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},Moq.Times)">
|
|
<summary>
|
|
Verifies that a property has been set on the mock, regardless
|
|
of the value but only the specified number of times.
|
|
</summary>
|
|
<example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given invocation
|
|
with specific parameters was performed:
|
|
<code>
|
|
var mock = new Mock<IWarehouse>();
|
|
// exercise mock
|
|
//...
|
|
// Will throw if the test code didn't set the IsClosed property.
|
|
mock.VerifySet(warehouse => warehouse.IsClosed);
|
|
</code>
|
|
</example>
|
|
<exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception>
|
|
<exception cref="T:Moq.MockException">The invocation was not call the times specified by
|
|
<paramref name="times"/>.</exception>
|
|
<param name="mock">The mock instance.</param>
|
|
<typeparam name="T">Mocked type.</typeparam>
|
|
<param name="times">The number of times a method is allowed to be called.</param>
|
|
<param name="expression">Expression to verify.</param>
|
|
<typeparam name="TProperty">Type of the property to verify. Typically omitted as it can
|
|
be inferred from the expression's return type.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.MockExtensions.VerifySet``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},Moq.Times,System.String)">
|
|
<summary>
|
|
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.
|
|
</summary>
|
|
<example group="verification">
|
|
This example assumes that the mock has been used,
|
|
and later we want to verify that a given invocation
|
|
with specific parameters was performed:
|
|
<code>
|
|
var mock = new Mock<IWarehouse>();
|
|
// exercise mock
|
|
//...
|
|
// Will throw if the test code didn't set the IsClosed property.
|
|
mock.VerifySet(warehouse => warehouse.IsClosed);
|
|
</code>
|
|
</example>
|
|
<exception cref="T:Moq.MockException">The invocation was not performed on the mock.</exception>
|
|
<exception cref="T:Moq.MockException">The invocation was not call the times specified by
|
|
<paramref name="times"/>.</exception>
|
|
<param name="mock">The mock instance.</param>
|
|
<typeparam name="T">Mocked type.</typeparam>
|
|
<param name="times">The number of times a method is allowed to be called.</param>
|
|
<param name="failMessage">Message to show if verification fails.</param>
|
|
<param name="expression">Expression to verify.</param>
|
|
<typeparam name="TProperty">Type of the property to verify. Typically omitted as it can
|
|
be inferred from the expression's return type.</typeparam>
|
|
</member>
|
|
<member name="T:Moq.Mocks">
|
|
<summary>
|
|
Allows querying the universe of mocks for those that behave
|
|
according to the query specification.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Mocks.Query``1">
|
|
<summary>
|
|
Creates a query for mocks of the given type.
|
|
</summary>
|
|
<typeparam name="T">The type of mocked object to query.</typeparam>
|
|
</member>
|
|
<member name="M:Moq.Mocks.CreateReal``1">
|
|
<summary>
|
|
Method that is turned into the actual call from .Query{T}, to
|
|
transform the queryable query into a normal enumerable query.
|
|
This method should not be used by consumers.
|
|
</summary>
|
|
<typeparam name="T"></typeparam>
|
|
<returns></returns>
|
|
</member>
|
|
<member name="F:Moq.Mocks.FluentMockVisitor.isFirst">
|
|
<summary>
|
|
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.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.QueryableMockExtensions">
|
|
<summary>
|
|
Helper extensions that are used by the query translator.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.QueryableMockExtensions.FluentMock``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}})">
|
|
<summary>
|
|
Retrieves a fluent mock from the given setup expression.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Stub.StubExtensions">
|
|
<summary>
|
|
Legacy Stub stuff, moved to the core API.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Stub.StubExtensions.Stub``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}})">
|
|
<summary>
|
|
Obsolete. Use <see cref="M:Moq.Mock`1.SetupProperty``1(System.Linq.Expressions.Expression{System.Func{`0,``0}})"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Stub.StubExtensions.Stub``2(Moq.Mock{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1)">
|
|
<summary>
|
|
Obsolete. Use <see cref="M:Moq.Mock`1.SetupProperty``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},``0)"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Stub.StubExtensions.StubAll``1(Moq.Mock{``0})">
|
|
<summary>
|
|
Obsolete. Use <see cref="M:Moq.Mock`1.SetupAllProperties"/>.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Moq.Times">
|
|
<summary>
|
|
Defines the number of invocations allowed by a mocked method.
|
|
</summary>
|
|
</member>
|
|
<member name="M:Moq.Times.AtLeast(System.Int32)">
|
|
<summary>
|
|
Specifies that a mocked method should be invoked <paramref name="times"/> times as minimum.
|
|
</summary>
|
|
<param name="callCount">The minimun number of times.</param>
|
|
<returns>An object defining the allowed number of invocations.</returns>
|
|
</member>
|
|
<member name="M:Moq.Times.AtLeastOnce">
|
|
<summary>
|
|
Specifies that a mocked method should be invoked one time as minimum.
|
|
</summary>
|
|
<returns>An object defining the allowed number of invocations.</returns>
|
|
</member>
|
|
<member name="M:Moq.Times.AtMost(System.Int32)">
|
|
<summary>
|
|
Specifies that a mocked method should be invoked <paramref name="times"/> time as maximun.
|
|
</summary>
|
|
<param name="callCount">The maximun number of times.</param>
|
|
<returns>An object defining the allowed number of invocations.</returns>
|
|
</member>
|
|
<member name="M:Moq.Times.AtMostOnce">
|
|
<summary>
|
|
Specifies that a mocked method should be invoked one time as maximun.
|
|
</summary>
|
|
<returns>An object defining the allowed number of invocations.</returns>
|
|
</member>
|
|
<member name="M:Moq.Times.Between(System.Int32,System.Int32,Moq.Range)">
|
|
<summary>
|
|
Specifies that a mocked method should be invoked between <paramref name="from"/> and
|
|
<paramref name="to"/> times.
|
|
</summary>
|
|
<param name="callCountFrom">The minimun number of times.</param>
|
|
<param name="callCountTo">The maximun number of times.</param>
|
|
<param name="rangeKind">The kind of range. See <see cref="T:Moq.Range"/>.</param>
|
|
<returns>An object defining the allowed number of invocations.</returns>
|
|
</member>
|
|
<member name="M:Moq.Times.Exactly(System.Int32)">
|
|
<summary>
|
|
Specifies that a mocked method should be invoked exactly <paramref name="times"/> times.
|
|
</summary>
|
|
<param name="callCount">The times that a method or property can be called.</param>
|
|
<returns>An object defining the allowed number of invocations.</returns>
|
|
</member>
|
|
<member name="M:Moq.Times.Never">
|
|
<summary>
|
|
Specifies that a mocked method should not be invoked.
|
|
</summary>
|
|
<returns>An object defining the allowed number of invocations.</returns>
|
|
</member>
|
|
<member name="M:Moq.Times.Once">
|
|
<summary>
|
|
Specifies that a mocked method should be invoked exactly one time.
|
|
</summary>
|
|
<returns>An object defining the allowed number of invocations.</returns>
|
|
</member>
|
|
</members>
|
|
</doc>
|