Update [AutoConstructor] attribute to ignore generated fields

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-29 12:58:19 +02:00
1 親 459517a181
コミット 7d14403632
2ファイル変更
+32 -1

検索条件に一致するファイルはありません

+31
ファイルの表示
@@ -54,4 +54,35 @@ public unsafe partial class AutoConstructorAttributeTests
Assert.AreEqual(instance.a, a);
Assert.AreEqual(instance.b, b);
}
public partial interface IAnotherInterface
{
public int B { get; }
public void Foo();
}
public partial struct AnotherStruct : IAnotherInterface
{
public int a;
public float b;
int IAnotherInterface.B { get; }
void IAnotherInterface.Foo()
{
}
}
[TestMethod]
public void GenerateConstructorWithExplicitInterfaceMembers()
{
int a = 42;
float b = 3.14f;
AnotherStruct instance = new(a, b);
Assert.AreEqual(instance.a, a);
Assert.AreEqual(instance.b, b);
}
}