Skip to content

Commit 1bbeba3

Browse files
committed
Add failing test for record with operator
1 parent 1777341 commit 1bbeba3

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

src/Castle.Core.Tests/DynamicProxy.Tests/RecordsTestCase.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2004-2022 Castle Project - http://www.castleproject.org/
1+
// Copyright 2004-2025 Castle Project - http://www.castleproject.org/
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using Castle.DynamicProxy.Tests.Records;
16-
17-
using NUnit.Framework;
18-
1915
namespace Castle.DynamicProxy.Tests
2016
{
17+
using Castle.DynamicProxy.Tests.Records;
18+
19+
using NUnit.Framework;
20+
2121
[TestFixture]
2222
public class RecordsTestCase : BasePEVerifyTestCase
2323
{
@@ -44,5 +44,15 @@ public void Can_proxy_record_derived_from_empty_generic_record()
4444
{
4545
_ = generator.CreateClassProxy<DerivedFromEmptyGenericRecord>(new StandardInterceptor());
4646
}
47+
48+
[Test]
49+
public void Cloning_a_record_proxy_yields_another_proxy_of_the_same_type()
50+
{
51+
var proxy = generator.CreateClassProxy<EmptyRecord>();
52+
var clonedProxy = proxy with { };
53+
Assert.True(ProxyUtil.IsProxy(clonedProxy));
54+
Assert.AreSame(proxy.GetType(), clonedProxy.GetType());
55+
}
56+
4757
}
4858
}

0 commit comments

Comments
 (0)