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
Add static proxy generator based on Stunts.StaticProxy
Cleanup CodeAnalysis with just the stuff we need, move CodeFix stuff
over to Moq.StaticProxy. Add tests for the codegen too.
  • Loading branch information
kzu committed Oct 23, 2020
commit 3c39eef1b67b433f962dd8fb07c751ce9460f613
18 changes: 18 additions & 0 deletions Moq.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.DynamicProxy", "src\Moq
EndProject
Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "Moq.Package", "src\Moq\Moq.Package\Moq.Package.msbuildproj", "{D486033C-1CCF-47BB-BDA6-28EA08018CDE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.StaticProxy", "src\Moq\Moq.StaticProxy\Moq.StaticProxy.csproj", "{0580AEDE-7661-4311-9A40-EAD4CD485742}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.CodeAnalysis", "src\Moq\Moq.CodeAnalysis\Moq.CodeAnalysis.csproj", "{1D05F2B9-B67D-4EFE-B4FF-D7F6907C2701}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.StaticProxy.UnitTests", "src\Moq\Moq.StaticProxy.UnitTests\Moq.StaticProxy.UnitTests.csproj", "{36A3DD24-4B67-4A9E-83F8-C4794336460F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -55,6 +61,18 @@ Global
{D486033C-1CCF-47BB-BDA6-28EA08018CDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D486033C-1CCF-47BB-BDA6-28EA08018CDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D486033C-1CCF-47BB-BDA6-28EA08018CDE}.Release|Any CPU.Build.0 = Release|Any CPU
{0580AEDE-7661-4311-9A40-EAD4CD485742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0580AEDE-7661-4311-9A40-EAD4CD485742}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0580AEDE-7661-4311-9A40-EAD4CD485742}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0580AEDE-7661-4311-9A40-EAD4CD485742}.Release|Any CPU.Build.0 = Release|Any CPU
{1D05F2B9-B67D-4EFE-B4FF-D7F6907C2701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D05F2B9-B67D-4EFE-B4FF-D7F6907C2701}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D05F2B9-B67D-4EFE-B4FF-D7F6907C2701}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D05F2B9-B67D-4EFE-B4FF-D7F6907C2701}.Release|Any CPU.Build.0 = Release|Any CPU
{36A3DD24-4B67-4A9E-83F8-C4794336460F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36A3DD24-4B67-4A9E-83F8-C4794336460F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36A3DD24-4B67-4A9E-83F8-C4794336460F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36A3DD24-4B67-4A9E-83F8-C4794336460F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@

<!-- Generate satellite assemblies using csc.exe to avoid some al.exe issues. See https://github.com/dotnet/msbuild/pull/2726 -->
<GenerateSatelliteAssembliesForCore>true</GenerateSatelliteAssembliesForCore>

<!-- Since we use Moq4 in many projects, not necessarily v5... -->
<EnablePackCleanup>false</EnablePackCleanup>
</PropertyGroup>

<PropertyGroup Label="Preview - To be removed by .NET 5.0 RTW">
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<UpToDateCheck Include="@(PackageFile);@(None);@(Content);@(EmbeddedResource)" />
<EmbeddedResource Update="@(EmbeddedResource)" Generator="ResXFileCodeGenerator" />
<EmbeddedResource Update="@(EmbeddedResource)" />
<!--<None Include="$(MSBuildThisFileDirectory)../docs/img/icon.png" Pack="true" Visible="false" />-->
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<NuGetizerVersion>0.4.7</NuGetizerVersion>
<NuGetizerVersion Condition="Exists('$(MSBuildThisFileDirectory)..\..\nugetizer\bin\')">42.42.42</NuGetizerVersion>
<StuntsVersion>42.42.42-main.129</StuntsVersion>
<StuntsVersion>42.42.42-main.140</StuntsVersion>
<StuntsVersion Condition="Exists('$(MSBuildThisFileDirectory)..\..\stunts\bin\')">42.42.42</StuntsVersion>
</PropertyGroup>

Expand Down
3 changes: 0 additions & 3 deletions src/Moq/Moq.CodeAnalysis/AssemblyInfo.cs

This file was deleted.

8 changes: 0 additions & 8 deletions src/Moq/Moq.CodeAnalysis/GlobalSuppressions.cs

This file was deleted.

37 changes: 0 additions & 37 deletions src/Moq/Moq.CodeAnalysis/MockDiagnostics.cs

This file was deleted.

26 changes: 0 additions & 26 deletions src/Moq/Moq.CodeAnalysis/MockGeneratorAnalyzer.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Moq/Moq.CodeAnalysis/MockNamingConvention.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Moq.Sdk;
using Stunts;
using Stunts.CodeAnalysis;

namespace Moq
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace Stunts
/// </summary>
// TODO: F#
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
public class MockUnsupportedNestedTypeAnalyzer : UnsupportedNestedTypeAnalyzer
public class MockUnsupportedNestedTypeAnalyzer : NestedTypeAnalyzer
{
/// <summary>
/// Instantiates the analyzer with the default <see cref="NamingConvention"/> and
/// for method invocations annotated with <see cref="StuntGeneratorAttribute"/>.
/// </summary>
public MockUnsupportedNestedTypeAnalyzer() : base(new MockNamingConvention(), typeof(MockGeneratorAttribute)) { }
public MockUnsupportedNestedTypeAnalyzer() : base(typeof(MockGeneratorAttribute)) { }
}
}
49 changes: 26 additions & 23 deletions src/Moq/Moq.CodeAnalysis/Moq.CodeAnalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,48 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Moq</RootNamespace>
<IncludeRoslyn>true</IncludeRoslyn>
<PrimaryOutputKind Condition="'$(PrimaryOutputKind)' == ''">Analyzers</PrimaryOutputKind>
<PrimaryOutputFrameworkSpecific>true</PrimaryOutputFrameworkSpecific>
<PackFolder>analyzers\dotnet</PackFolder>
</PropertyGroup>

<ItemDefinitionGroup>
<ProjectReference>
<!-- This causes the output of the referenced projects to be packaged into the analyzer folder too -->
<AdditionalProperties>PrimaryOutputKind=$(PrimaryOutputKind)</AdditionalProperties>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<Compile Remove="MockValidateTypesAnalyzer.cs" />
<Compile Remove="RecursiveMockAnalyzer.cs" />
</ItemGroup>

<ItemGroup>
<None Include="MockValidateTypesAnalyzer.cs" />
<None Include="RecursiveMockAnalyzer.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Stunts" />
<PackageReference Include="Stunts.CodeAnalysis" />
<PackageReference Include="Superpower" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Pack="false" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Pack="false" />

<!-- Workaround for revision mismatch with public versions -->
<PackageReference Include="System.Collections.Immutable" Pack="false" />
<PackageReference Include="System.Reflection.Metadata" Pack="false" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Stunts\Stunts\Stunts.csproj" Pack="false" />
<ProjectReference Include="..\..\Stunts\Stunts.CodeAnalysis\Stunts.CodeAnalysis.csproj" Pack="false" />
<ProjectReference Include="..\Moq.Sdk\Moq.Sdk.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<EmbeddedResource Update="@(EmbeddedResource)" Generator="ResXFileCodeGenerator" />
<EmbeddedResource Update="Resources.resx">
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<Target Name="IncludeRoslynVisualBasic" AfterTargets="ResolveAssemblyReferences" BeforeTargets="GetPackageContents" DependsOnTargets="ResolveAssemblyReferences">
<ItemGroup>
<_RoslynVisualBasic Include="@(ReferencePath -> WithMetadataValue('NuGetPackageId', 'Microsoft.CodeAnalysis.VisualBasic'))" />
<PackageFile Include="@(_RoslynVisualBasic -> '%(FullPath)')" Kind="Analyzer" FrameworkSpecific="true" TargetFramework="$(TargetFramework)" />
</ItemGroup>
</Target>


</Project>
9 changes: 0 additions & 9 deletions src/Moq/Moq.CodeAnalysis/Properties/launchSettings.json

This file was deleted.

22 changes: 0 additions & 22 deletions src/Moq/Moq.CodeAnalysis/ResourceString.cs

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions src/Moq/Moq.CodeFix/MockCodeAction.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Moq/Moq.Package/Mock.StaticFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ partial class Mock
{
static Mock()
{
MockFactory.Default = new Sdk.StaticMockFactory();
Sdk.MockFactory.Default = new Sdk.StaticMockFactory();
OnInitialized();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Moq/Moq.Package/Moq.Package.msbuildproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<PackageTags>moq mocking mock</PackageTags>
</PropertyGroup>
<ItemGroup>
<Content Include="*.cs" CodeLanguage="cs" TargetFramework="netstandard2.0" BuildAction="Compile" />
<Content Include="*.vb" CodeLanguage="vb" TargetFramework="netstandard2.0" BuildAction="Compile" />
<Content Include="*.cs" Exclude="Mock.StaticFactory.*" CodeLanguage="cs" TargetFramework="netstandard2.0" BuildAction="Compile" />
<Content Include="*.vb" Exclude="Mock.StaticFactory.*" CodeLanguage="vb" TargetFramework="netstandard2.0" BuildAction="Compile" />
<None Include="Mock.StaticFactory.*" PackFolder="build\netstandard2.0" />
<None Include="Moq.props" PackFolder="build\netstandard2.0" />
<None Include="Moq.targets" PackFolder="build\netstandard2.0" />
Expand Down
4 changes: 0 additions & 4 deletions src/Moq/Moq.Sdk/Moq.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@
<PackageReference Include="ThisAssembly" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resources.resx" Generator="" />
</ItemGroup>

</Project>
Loading