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
36 commits
Select commit Hold shift + click to select a range
674fbbb
Migrate to new Stunts nuget package, simplify build
kzu Oct 21, 2020
6e5dafa
Add github actions for CI
kzu Oct 21, 2020
135276b
Fix build from missing versioning logic in sample, bump stunts
kzu Oct 21, 2020
8c6d08e
Replace codecov token and move to secret
kzu Oct 21, 2020
ac3a340
Fix windows tests by strong-naming the sample
kzu Oct 21, 2020
034afe6
Remove stunt classes and use the ManualStunts package
kzu Oct 21, 2020
6bd315d
Bundle DynamicProxy in Moq itself for convenience
kzu Oct 22, 2020
d45d4e7
Switch from attribute-based registration to partial static ctor
kzu Oct 22, 2020
83a9dcd
Fix project reference in packaging project
kzu Oct 22, 2020
f3d229a
Basic implementation of the static mock factory
kzu Oct 22, 2020
c7e3e45
Bump Stunts
kzu Oct 22, 2020
3c39eef
Add static proxy generator based on Stunts.StaticProxy
kzu Oct 23, 2020
9d9b4ba
Eliminate all nullable warnings and accept most analysis suggestions
kzu Oct 23, 2020
07e1b2c
Remove unused code
kzu Oct 23, 2020
645ec40
Collect and upload binlogs and coverage reports
kzu Oct 23, 2020
452d3d7
Disable coverage online reporting since it's not working
kzu Oct 23, 2020
a498340
Move all projects one level up
kzu Oct 23, 2020
29c8667
Drop azure pipelines, GH actions are enough
kzu Oct 24, 2020
43c467c
Improve readme docs and dogfooding instructions
kzu Oct 24, 2020
6466cd8
Add minimum required recursive mocking support
kzu Oct 24, 2020
7b9d008
No need to multitarget the static proxy generator
kzu Oct 24, 2020
fd2173d
Make sure to also pack as buildTransitive for generators
kzu Oct 26, 2020
6465fde
Remove usage of older TypeInfo
kzu Oct 26, 2020
ce6e82b
Use TypeInfo in AnyMatcher to fix breakage of ref/out tests
kzu Oct 26, 2020
4f2ef0a
Remove unnecessary scope attribute
kzu Oct 26, 2020
cbf179e
Add test for setup scope recursive codegen
kzu Oct 26, 2020
d1727c8
Minor API docs improvements
kzu Oct 26, 2020
f670990
Add Setup extension method on mocks for discoverability
kzu Oct 26, 2020
630b728
Cleanup old samples, add new acceptance tests
kzu Oct 26, 2020
01e461e
Cleanup just the local build version of Moq
kzu Oct 26, 2020
c1250ea
Bump stunts
kzu Oct 26, 2020
8b2b914
Fix dynamic factory registration
kzu Oct 26, 2020
04af272
File header and pragmas have to be the last fixups to run
kzu Oct 26, 2020
614ca47
Add unit tests boilerplate project for Moq.CodeAnalysis
kzu Oct 26, 2020
e3f7bb3
Bump stunts to avoid warnings on generated code
kzu Oct 26, 2020
b36e0fb
Only push packages after build and acceptance
kzu Oct 26, 2020
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
Remove unnecessary scope attribute
We are not using the attribute for codegen or at run-time, to just remove it.
  • Loading branch information
kzu committed Oct 26, 2020
commit 4f2ef0a6fe77cce724e212ac295e4880e85756ed
19 changes: 0 additions & 19 deletions src/Moq.Sdk/SetupScopeAttribute.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/Moq.StaticProxy/MockSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ protected override void OnExecute(GeneratorExecutionContext context, StuntDocume
receivers.OfType<RecursiveMockSyntaxReceiver>().FirstOrDefault() is var recursive)
{
var generatorAttr = context.Compilation.GetTypeByMetadataName(generator.GeneratorAttribute.FullName!);
var scopeAttr = context.Compilation.GetTypeByMetadataName(typeof(SetupScopeAttribute).FullName!);
var moqmodule = context.Compilation.GetTypeByMetadataName("Moq.IMoq")!.ContainingModule;
var sdkmodule = context.Compilation.GetTypeByMetadataName(typeof(IMock).FullName!)!.ContainingModule;

// If we can't know what's the attribute that annotates mock generators, we can't do anything.
if (generatorAttr != null || scopeAttr != null)
if (generatorAttr != null)
{
foreach (var node in recursive.CandidateNodes)
{
Expand Down
6 changes: 1 addition & 5 deletions src/Moq/SetupExtension.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;

namespace Moq
Expand All @@ -14,7 +14,6 @@ public static class SetupExtension
/// <summary>
/// Sets up the mock with the given void method call.
/// </summary>
[SetupScope]
public static ISetup Setup<T>(this T mock, Action<T> action)
{
using (new SetupScope())
Expand All @@ -27,7 +26,6 @@ public static ISetup Setup<T>(this T mock, Action<T> action)
/// <summary>
/// Sets up the mock with the given function.
/// </summary>
[SetupScope]
public static TResult Setup<T, TResult>(this T mock, Func<T, TResult> function)
{
using (new SetupScope())
Expand All @@ -41,7 +39,6 @@ public static TResult Setup<T, TResult>(this T mock, Func<T, TResult> function)
/// access and set ref/out arguments. A code fix will automatically
/// generate a delegate with the right signature when using this overload.
/// </summary>
[SetupScope]
public static ISetup<TDelegate> Setup<TDelegate>(this object mock, TDelegate member)
=> new DefaultSetup<TDelegate>(member as Delegate ?? throw new ArgumentException(ThisAssembly.Strings.Setup.DelegateExpected));

Expand All @@ -53,7 +50,6 @@ public static ISetup<TDelegate> Setup<TDelegate>(this object mock, TDelegate mem
/// and pass in the method group directly instead. A code fix will automatically
/// generate a delegate with the right signature when using this overload.
/// </summary>
[SetupScope]
public static ISetup<TDelegate> Setup<TDelegate>(this object mock, Func<TDelegate> memberFunction)
{
using (new SetupScope())
Expand Down