@@ -39,72 +39,72 @@ namespace Vanara.PInvoke.Tests;
3939[ TestFixture ]
4040public class CodeGenTests
4141{
42- [ Test ]
43- public void AddAsMemberTest ( )
44- {
45- const string src = /* lang=c#-test */ """
46- using System;
47- using System.Runtime.InteropServices;
48- namespace Vanara.PInvoke
49- {
50- [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
51- public sealed class AddAsMemberAttribute : Attribute { }
42+ // [Test]
43+ // public void AddAsMemberTest()
44+ // {
45+ // const string src = /* lang=c#-test */ """
46+ // using System;
47+ // using System.Runtime.InteropServices;
48+ // namespace Vanara.PInvoke
49+ // {
50+ // [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
51+ // public sealed class AddAsMemberAttribute : Attribute { }
5252
53- [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false, AllowMultiple = false)]
54- public sealed class AddAsCtorAttribute : Attribute { }
53+ // [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false, AllowMultiple = false)]
54+ // public sealed class AddAsCtorAttribute : Attribute { }
5555
56- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
57- public sealed class IgnoreAttribute : Attribute { }
56+ // [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
57+ // public sealed class IgnoreAttribute : Attribute { }
5858
59- public static partial class Test32
60- {
61- public partial struct HTEST { }
59+ // public static partial class Test32
60+ // {
61+ // public partial struct HTEST { }
6262
63- public partial class SafeHTEST { }
63+ // public partial class SafeHTEST { }
6464
65- [DllImport("test32.dll", SetLastError = true)]
66- public static extern bool IsExcluded([AddAsMember] HTEST2 hTest);
65+ // [DllImport("test32.dll", SetLastError = true)]
66+ // public static extern bool IsExcluded([AddAsMember] HTEST2 hTest);
6767
68- /// <summary>Determines if a test is active.</summary>
69- /// <param name="hTest">The test handle.</param>
70- /// <param name="flag">The flag.</param>
71- /// <returns><see langword="true"/> on success, <see langword="false"/> on failure.</returns>
72- [DllImport("test32.dll", SetLastError = true)]
73- public static extern bool IsActive<T>([AddAsMember] HTEST hTest, T t, [Optional, Ignore] uint flag) where T : struct;
68+ // /// <summary>Determines if a test is active.</summary>
69+ // /// <param name="hTest">The test handle.</param>
70+ // /// <param name="flag">The flag.</param>
71+ // /// <returns><see langword="true"/> on success, <see langword="false"/> on failure.</returns>
72+ // [DllImport("test32.dll", SetLastError = true)]
73+ // public static extern bool IsActive<T>([AddAsMember] HTEST hTest, T t, [Optional, Ignore] uint flag) where T : struct;
7474
75- /// <summary>Gets a test name.</summary>
76- /// <param name="hTest">The test handle.</param>
77- /// <param name="ptr">The pointer to the name buffer.</param>
78- /// <param name="sz">The size of the name buffer.</param>
79- /// <param name="name">The name.</param>
80- /// <returns><see langword="true"/> on success, <see langword="false"/> on failure.</returns>
81- [DllImport("test32.dll", SetLastError = true)]
82- public static extern bool GetName([AddAsMember] HTEST hTest, [In, Optional, SizeDef(nameof(sz))] IntPtr ptr, uint sz, out string? name);
75+ // /// <summary>Gets a test name.</summary>
76+ // /// <param name="hTest">The test handle.</param>
77+ // /// <param name="ptr">The pointer to the name buffer.</param>
78+ // /// <param name="sz">The size of the name buffer.</param>
79+ // /// <param name="name">The name.</param>
80+ // /// <returns><see langword="true"/> on success, <see langword="false"/> on failure.</returns>
81+ // [DllImport("test32.dll", SetLastError = true)]
82+ // public static extern bool GetName([AddAsMember] HTEST hTest, [In, Optional, SizeDef(nameof(sz))] IntPtr ptr, uint sz, out string? name);
8383
84- /// <summary>Sets a test name.</summary>
85- /// <param name="hTest">The test handle.</param>
86- /// <param name="name">The name.</param>
87- /// <param name="code">The code.</param>
88- /// <returns><see langword="true"/> on success, <see langword="false"/> on failure.</returns>
89- [DllImport("test32.dll", SetLastError = true)]
90- public static extern bool SetName([AddAsMember] HTEST hTest, string? name, [Ignore] uint code = 0);
84+ // /// <summary>Sets a test name.</summary>
85+ // /// <param name="hTest">The test handle.</param>
86+ // /// <param name="name">The name.</param>
87+ // /// <param name="code">The code.</param>
88+ // /// <returns><see langword="true"/> on success, <see langword="false"/> on failure.</returns>
89+ // [DllImport("test32.dll", SetLastError = true)]
90+ // public static extern bool SetName([AddAsMember] HTEST hTest, string? name, [Ignore] uint code = 0);
9191
92- /// <summary>Creates a test.</summary>
93- /// <param name="name">The name.</param>
94- /// <param name="code">The code.</param>
95- /// <param name="test">The test handle.</param>
96- /// <returns><see langword="true"/> on success, <see langword="false"/> on failure.</returns>
97- [DllImport("test32.dll", SetLastError = true)]
98- public static extern bool CreateTest(string? name, [Optional][Ignore] uint code, [AddAsCtor] out SafeHTEST test);
99- }
100- }
101- """ ;
102- var compilation = GetCompilation ( src ) ;
103- CreateGeneratorDriverAndRun ( compilation , new AddAsMemberGenerator ( ) , null , out var output , out var diag ) ;
104- Assert . That ( output . SyntaxTrees , Has . Exactly ( 2 ) . Items ) ;
105- Assert . That ( diag . Where ( d => d . Severity == DiagnosticSeverity . Error ) , Has . Exactly ( 1 ) . Items ) ;
106- WriteTrees ( TestContext . Out , output . SyntaxTrees , false ) ;
107- }
92+ // /// <summary>Creates a test.</summary>
93+ // /// <param name="name">The name.</param>
94+ // /// <param name="code">The code.</param>
95+ // /// <param name="test">The test handle.</param>
96+ // /// <returns><see langword="true"/> on success, <see langword="false"/> on failure.</returns>
97+ // [DllImport("test32.dll", SetLastError = true)]
98+ // public static extern bool CreateTest(string? name, [Optional][Ignore] uint code, [AddAsCtor] out SafeHTEST test);
99+ // }
100+ // }
101+ // """;
102+ // var compilation = GetCompilation(src);
103+ // CreateGeneratorDriverAndRun(compilation, new AddAsMemberGenerator(), null, out var output, out var diag);
104+ // Assert.That(output.SyntaxTrees, Has.Exactly(2).Items);
105+ // Assert.That(diag.Where(d => d.Severity == DiagnosticSeverity.Error), Has.Exactly(1).Items);
106+ // WriteTrees(TestContext.Out, output.SyntaxTrees, false);
107+ // }
108108
109109 [ Test ]
110110 public void AutoHandleTest ( )
0 commit comments