diff --git a/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs b/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs index b0dc3180..1681d9db 100644 --- a/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs +++ b/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs @@ -556,6 +556,18 @@ public void ObsoleteAttributePropagated() Assert.Contains(field!.Value.Field.AttributeLists, al => IsAttributePresent(al, "Obsolete")); } + [Fact] + public void GetObjectAcceptsSafeHandle() + { + this.generator = new Generator(this.metadataStream, DefaultTestGeneratorOptions, this.compilation, this.parseOptions); + Assert.True(this.generator.TryGenerate("GetObject", CancellationToken.None)); + this.CollectGeneratedCode(this.generator); + this.AssertNoDiagnostics(); + Assert.Contains( + this.FindGeneratedMethod("GetObject"), + method => method.ParameterList.Parameters[0].Type is QualifiedNameSyntax { Right: { Identifier: { ValueText: "SafeHandle" } } }); + } + [Fact] public void ReleaseMethodGeneratedWithHandleStruct() {