Skip to content

Commit

Permalink
Restore provider correctly in FluentMockContext
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Dec 3, 2017
1 parent 2818672 commit 7ffb12e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Source/FluentMockContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ public void Dispose()

internal class MockInvocation : IDisposable
{
private DefaultValue defaultValue;
private DefaultValueProvider defaultValueProvider;

public MockInvocation(Mock mock, Invocation invocation, Match matcher)
{
this.Mock = mock;
this.Invocation = invocation;
this.Match = matcher;
defaultValue = mock.DefaultValue;
this.defaultValueProvider = mock.DefaultValueProvider;

// Temporarily set mock default value to Mock so that recursion works.
mock.DefaultValue = DefaultValue.Mock;
}
Expand All @@ -120,7 +121,7 @@ public MockInvocation(Mock mock, Invocation invocation, Match matcher)

public void Dispose()
{
Mock.DefaultValue = defaultValue;
this.Mock.DefaultValueProvider = this.defaultValueProvider;
}
}
}
Expand Down

0 comments on commit 7ffb12e

Please sign in to comment.