Skip to content

Commit 4ab6ce1

Browse files
authored
Merge pull request #1275 from stakx/records
Upgrade DynamicProxy to version 5.1.0 for better `record` type support
2 parents e2460df + 6878a90 commit 4ab6ce1

4 files changed

Lines changed: 44 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66

77

8+
## Unreleased
9+
10+
#### Changed
11+
12+
* Update package reference to `Castle.Core` (DynamicProxy) from version 5.0.0 to 5.1.0 (@stakx, #1275)
13+
14+
#### Fixed
15+
16+
* Throws `TypeLoadException` on mock when a record has a base record on .NET 6 (@tgrieger-sf, #1273)
17+
18+
819
## 4.18.1 (2022-05-16)
920

1021
#### Fixed

src/Moq/Moq.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</PropertyGroup>
4444

4545
<ItemGroup>
46-
<PackageReference Include="Castle.Core" Version="5.0.0" />
46+
<PackageReference Include="Castle.Core" Version="5.1.0" />
4747
<PackageReference Include="IFluentInterface" Version="2.1.0" PrivateAssets="All" />
4848
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
4949
<PackageReference Include="TypeNameFormatter.Sources" Version="1.0.0" PrivateAssets="All" />

tests/Moq.Tests/Moq.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<DebugSymbols>True</DebugSymbols>
1111
<DebugType>portable</DebugType>
1212
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
13-
<LangVersion>8.0</LangVersion>
13+
<LangVersion>9.0</LangVersion>
1414
<IsPackable>False</IsPackable>
1515
<NoWarn>$(NoWarn);CS8032</NoWarn>
1616
</PropertyGroup>
@@ -23,7 +23,7 @@
2323
</PropertyGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Castle.Core" Version="5.0.0" />
26+
<PackageReference Include="Castle.Core" Version="5.1.0" />
2727
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.9" />
2828
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
2929
<PackageReference Include="System.ValueTuple" Version="4.5.0" />

tests/Moq.Tests/RecordsFixture.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD, and Contributors.
2+
// All rights reserved. Licensed under the BSD 3-Clause License; see License.txt.
3+
4+
using Xunit;
5+
6+
namespace Moq.Tests
7+
{
8+
public class RecordsFixture
9+
{
10+
[Fact]
11+
public void Can_mock_EmptyRecord()
12+
{
13+
_ = new Mock<EmptyRecord>().Object;
14+
}
15+
16+
[Fact]
17+
public void Can_mock_DerivedEmptyRecord()
18+
{
19+
_ = new Mock<DerivedEmptyRecord>().Object;
20+
}
21+
22+
public record EmptyRecord
23+
{
24+
}
25+
26+
public record DerivedEmptyRecord : EmptyRecord
27+
{
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)