Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
973fd6d
Initial support for a legacy API shim
kzu Jul 23, 2019
b83445a
Add codegen support for new Mock<T>
kzu Jul 23, 2019
a58ad2d
Setup should happen as soon as possible
kzu Jul 23, 2019
72a1a28
Make sure we use the test calling assembly
adalon Jul 24, 2019
df46b70
Added SkipBehavior support for behavior pipeline
adalon Jul 24, 2019
5aaca90
Add new behavior for setup scope runs
kzu Jul 24, 2019
0c2ff79
Add setup overloads to avoid the mock T argument
kzu Jul 24, 2019
60237fe
Added AsMoq extension method
adalon Jul 24, 2019
eda348b
Simplify Behavior implementation by using SkipBehaviors
kzu Jul 24, 2019
edc7b68
Revert "Add setup overloads to avoid the mock T argument"
kzu Jul 24, 2019
efeefc3
Fix failing tests
kzu Jul 24, 2019
4e9d640
Move setup scope to Moq
kzu Jul 24, 2019
004e96e
Fix visiblity of various Sdk-like classes in the Moq main assembly
kzu Jul 24, 2019
91b4853
Added CallBase support
adalon Jul 24, 2019
58a67fe
Don't run FixupImports twice
kzu Jul 25, 2019
3f191e7
Ensure both analyzers and codefixers have NuGetPackageId metadata
kzu Jul 25, 2019
4c5db10
Optimize codegen performance for real world solutions
kzu Jul 25, 2019
e159b48
Do not clean unused namespaces, since it is costly for little benefit
kzu Jul 25, 2019
814afdc
Bump to latest Roslyn for VS2017 and updated supported code fix names
kzu Jul 25, 2019
708db5b
Ensure a clean restore is performed always, add CI feed
kzu Jul 25, 2019
20b9fd2
Set proper names for CallBase tests
adalon Jul 25, 2019
6143a8a
Bump TFV to the 16.0+ official one supporting NS2
kzu Jul 29, 2019
e5b1c4e
Properly generate code for generic mocks
kzu Aug 3, 2019
d9bbc2e
Add support for mocking generic types
kzu Aug 6, 2019
34a6c49
Move OverrideAllMembersCodeFix to CodeFix assembly to avoid csc error
kzu Aug 6, 2019
1e97239
Don't assume mocked types will be public
kzu Aug 6, 2019
e30d526
Cleanup and encapsulate the batch code fixer and avoid state capturing
kzu Aug 6, 2019
f4b4be4
Delete OverrideAllMembersCodeFix class that moved to CodeFix
kzu Aug 6, 2019
d5e5fd7
Re-enable end to end tests for VB since they work now
kzu Aug 6, 2019
cfddaf2
Fix roslyn internals tests from moved RoslynInternals.cs file
kzu Aug 8, 2019
2e4f6e8
Fix minor style issues flagged by codefactor.io
kzu Aug 8, 2019
462cf05
Unify naming conventions for runtime lookup
kzu Aug 8, 2019
83a22b0
Minor docs tweaks to CallBase
kzu Aug 8, 2019
db87731
Drastically simplify As<T> support by adding new Mock<T...Tn>
kzu Aug 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix failing tests
  • Loading branch information
kzu committed Jul 24, 2019
commit efeefc32ca067e16dd9edd084366123dedd20362
4 changes: 3 additions & 1 deletion src/Moq/Moq.Sdk.Tests/Fakes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class FakeSetup : IMockSetup
public class FakeInvocation : IMethodInvocation
{
public FakeInvocation() => Target = new Mocked();

public IArgumentCollection Arguments { get; set; }

public IDictionary<string, object> Context { get; set; }
Expand All @@ -51,6 +51,8 @@ public class FakeInvocation : IMethodInvocation

public object Target { get; set; }

public HashSet<Type> SkipBehaviors { get; } = new HashSet<Type>();

public IMethodReturn CreateExceptionReturn(Exception exception) => new FakeReturn { Exception = exception };

public IMethodReturn CreateValueReturn(object returnValue, params object[] allArguments) => new FakeReturn { ReturnValue = returnValue };
Expand Down
14 changes: 0 additions & 14 deletions src/Moq/Moq.Sdk.Tests/StrictMockBehaviorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,5 @@ public void AppliesToAllInvocations()
public void ThrowsStrictMockException()
=> Assert.Throws<StrictMockException>(() =>
new StrictMockBehavior().Execute(new FakeInvocation(), () => throw new NotImplementedException()));

[Fact]
public void ThrowsIfNullInvocation()
=> Assert.Throws<ArgumentNullException>(() =>
new StrictMockBehavior().Execute(null, () => throw new NotImplementedException()));

[Fact]
public void DoesNotThrowIfSetupScopeActive()
{
using (new SetupScope())
{
new StrictMockBehavior().Execute(new FakeInvocation(), () => (m, n) => m.CreateValueReturn(null));
}
}
}
}
4 changes: 2 additions & 2 deletions src/Moq/Moq.Tests/MoqTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void SetupDoesNotRecordCalls()
{
var calculator = Mock.Of<ICalculator>();

calculator.Setup(() => calculator.TurnOn());
calculator.Setup(c => c.TurnOn());

Assert.Empty(calculator.AsMock().Invocations);
}
Expand Down Expand Up @@ -273,7 +273,7 @@ public void CanSetupPropertyWithValueForStrictMock()
{
var calculator = Mock.Of<ICalculator>(MockBehavior.Strict);

calculator.Setup(c => c.Mode = CalculatorMode.Scientific);
calculator.Setup(c => c.Mode).Returns(CalculatorMode.Scientific);

var mode = calculator.Mode;

Expand Down