forked from devlooped/moq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodCallReturn.tt
More file actions
59 lines (53 loc) · 1.87 KB
/
Copy pathMethodCallReturn.tt
File metadata and controls
59 lines (53 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ output extension=".Generated.cs" #>
<#@ Assembly Name="System.Core" #>
<#@ Import Namespace="System.Linq" #>
using System;
using System.Diagnostics.CodeAnalysis;
using Moq.Language;
using Moq.Language.Flow;
namespace Moq
{
internal sealed partial class MethodCallReturn<TMock, TResult>
{
public IVerifies Raises<T>(Action<TMock> eventExpression, Func<T, EventArgs> func)
{
return this.RaisesImpl(eventExpression, func);
}
public IReturnsResult<TMock> Returns<T>(Func<T, TResult> valueExpression)
{
this.SetReturnDelegate(valueExpression);
return this;
}
[SuppressMessage("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods", Justification = "This class provides typed members for the method-returning interfaces. It's never used through the base class type.")]
public new IReturnsThrows<TMock, TResult> Callback<T>(Action<T> callback)
{
base.Callback(callback);
return this;
}
<#
for (var typeCount = 2; typeCount <= GenericTypeMax; typeCount++)
{
var typeList = GetGenericList(typeCount, GenericTypeFormat);
#>
public IVerifies Raises<<#= typeList #>>(Action<TMock> eventExpression, Func<<#= typeList #>, EventArgs> func)
{
return this.RaisesImpl(eventExpression, func);
}
public IReturnsResult<TMock> Returns<<#= typeList #>>(Func<<#= typeList #>, TResult> valueExpression)
{
this.SetReturnDelegate(valueExpression);
return this;
}
[SuppressMessage("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods", Justification = "This class provides typed members for the method-returning interfaces. It's never used through the base class type.")]
public new IReturnsThrows<TMock, TResult> Callback<<#= typeList #>>(Action<<#= typeList #>> callback)
{
base.Callback(callback);
return this;
}
<#
}
#>
}
}
<#@ Include File="Includes\GenericTypeParameters.tt" #>