forked from devlooped/moq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: .gitignore Source.Silverlight/Moq.Silverlight.csproj Source/Interceptor.cs Source/It.cs Source/It.xdoc Source/MethodCall.cs Source/Mock.Generic.cs Source/Moq.csproj Source/Proxy/CastleProxyFactory.cs UnitTests/MatchersFixture.cs UnitTests/MockFixture.cs UnitTests/MockedEventsFixture.cs UnitTests/Moq.Tests.csproj UnitTests/Regressions/IssueReportsFixture.cs UnitTests/VerifyFixture.cs
- Loading branch information
Showing
18 changed files
with
1,518 additions
and
847 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Moq.Proxy; | ||
|
||
namespace Moq | ||
{ | ||
internal enum InterceptionAction | ||
{ | ||
Continue, | ||
Stop | ||
} | ||
|
||
internal interface IInterceptStrategy | ||
{ | ||
/// <summary> | ||
/// Handle interception | ||
/// </summary> | ||
/// <param name="invocation">the current invocation context</param> | ||
/// <param name="ctx">shared data among the strategies during an interception</param> | ||
/// <returns>true if further interception has to be processed, otherwise false</returns> | ||
InterceptionAction HandleIntercept(ICallContext invocation, InterceptStrategyContext ctx); | ||
|
||
} | ||
|
||
internal class InterceptStrategyContext | ||
{ | ||
public InterceptStrategyContext(Mock Mock | ||
, Type targetType | ||
, Dictionary<string, List<Delegate>> invocationLists | ||
, List<ICallContext> actualInvocations | ||
, MockBehavior behavior | ||
, List<IProxyCall> orderedCalls | ||
) | ||
{ | ||
this.Behavior = behavior; | ||
this.Mock = Mock; | ||
this.InvocationLists = invocationLists; | ||
this.ActualInvocations = actualInvocations; | ||
this.TargetType = targetType; | ||
this.OrderedCalls = orderedCalls; | ||
} | ||
public Mock Mock {get;private set;} | ||
public Type TargetType { get; private set; } | ||
public Dictionary<string, List<Delegate>> InvocationLists { get; private set; } | ||
public List<ICallContext> ActualInvocations { get; private set; } | ||
public MockBehavior Behavior { get; private set; } | ||
public List<IProxyCall> OrderedCalls { get; private set; } | ||
public IProxyCall CurrentCall { get; set; } | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Moq | ||
{ | ||
/// <summary> | ||
/// Covarient interface for Mock<T> such that casts between IMock<Employee> to IMock<Person> | ||
/// are possible. Only covers the covariant members of Mock<T>. | ||
/// </summary> | ||
public interface IMock<out T> where T : class | ||
{ | ||
/// <include file='Mock.Generic.xdoc' path='docs/doc[@for="Mock{T}.Object"]/*'/> | ||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Object", Justification = "Exposes the mocked object instance, so it's appropriate.")] | ||
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "The public Object property is the only one visible to Moq consumers. The protected member is for internal use only.")] | ||
T Object { get; } | ||
|
||
/// <include file='Mock.xdoc' path='docs/doc[@for="Mock.Behavior"]/*'/> | ||
MockBehavior Behavior { get; } | ||
|
||
/// <include file='Mock.xdoc' path='docs/doc[@for="Mock.CallBase"]/*'/> | ||
bool CallBase { get; set; } | ||
|
||
/// <include file='Mock.xdoc' path='docs/doc[@for="Mock.DefaultValue"]/*'/> | ||
DefaultValue DefaultValue { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.