From 449092565586d9db38749e9257bb5bc1a4920c66 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Tue, 23 Apr 2024 10:59:26 +0200 Subject: [PATCH] Remove IHttpClient examples + rerun tests to generate files --- ProxyInterfaceSourceGenerator Solution.sln | 18 -- .../ConsoleAppIHttpClient.csproj | 13 -- src-examples/ConsoleAppIHttpClient/Program.cs | 13 -- src-examples/ConsoleAppIHttpClient/Todo.cs | 4 - src/IHttpClient/IHttpClient.cs | 7 - src/IHttpClient/IHttpClient.csproj | 58 ------ src/IHttpClient/IHttpClientJsonExtensions.cs | 173 ------------------ src/IHttpClient/IHttpMessageInvoker.cs | 7 - src/IHttpClient/Readme.md | 16 -- ...urce.AkkaActor.ILocalActorRefProvider.g.cs | 46 +---- ...urceGeneratorTests.Source.IHttpClient.g.cs | 36 ++-- ...ratorTests.Source.IHttpMessageInvoker.g.cs | 4 +- ...neratorTests.Source.PnP.IClientObject.g.cs | 8 +- ...ests.Source.PnP.IClientRuntimeContext.g.cs | 4 +- .../System.Net.Http.HttpClientProxy.g.cs | 36 ++-- 15 files changed, 40 insertions(+), 403 deletions(-) delete mode 100644 src-examples/ConsoleAppIHttpClient/ConsoleAppIHttpClient.csproj delete mode 100644 src-examples/ConsoleAppIHttpClient/Program.cs delete mode 100644 src-examples/ConsoleAppIHttpClient/Todo.cs delete mode 100644 src/IHttpClient/IHttpClient.cs delete mode 100644 src/IHttpClient/IHttpClient.csproj delete mode 100644 src/IHttpClient/IHttpClientJsonExtensions.cs delete mode 100644 src/IHttpClient/IHttpMessageInvoker.cs delete mode 100644 src/IHttpClient/Readme.md diff --git a/ProxyInterfaceSourceGenerator Solution.sln b/ProxyInterfaceSourceGenerator Solution.sln index 2da966b..56171fc 100644 --- a/ProxyInterfaceSourceGenerator Solution.sln +++ b/ProxyInterfaceSourceGenerator Solution.sln @@ -33,10 +33,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceConsumerForAk EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceConsumerViaNuGet", "src-examples\ProxyInterfaceConsumerViaNuGet\ProxyInterfaceConsumerViaNuGet.csproj", "{1EA000E4-6103-4577-8D98-BDDA3BE458A2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IHttpClient", "src\IHttpClient\IHttpClient.csproj", "{38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAppIHttpClient", "src-examples\ConsoleAppIHttpClient\ConsoleAppIHttpClient.csproj", "{3E93C092-0E42-4200-B71A-5EEE410FE1F5}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -79,18 +75,6 @@ Global {1EA000E4-6103-4577-8D98-BDDA3BE458A2}.DebugAttach|Any CPU.Build.0 = Debug|Any CPU {1EA000E4-6103-4577-8D98-BDDA3BE458A2}.Release|Any CPU.ActiveCfg = Release|Any CPU {1EA000E4-6103-4577-8D98-BDDA3BE458A2}.Release|Any CPU.Build.0 = Release|Any CPU - {38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3}.DebugAttach|Any CPU.ActiveCfg = Debug|Any CPU - {38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3}.DebugAttach|Any CPU.Build.0 = Debug|Any CPU - {38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3}.Release|Any CPU.Build.0 = Release|Any CPU - {3E93C092-0E42-4200-B71A-5EEE410FE1F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3E93C092-0E42-4200-B71A-5EEE410FE1F5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3E93C092-0E42-4200-B71A-5EEE410FE1F5}.DebugAttach|Any CPU.ActiveCfg = Debug|Any CPU - {3E93C092-0E42-4200-B71A-5EEE410FE1F5}.DebugAttach|Any CPU.Build.0 = Debug|Any CPU - {3E93C092-0E42-4200-B71A-5EEE410FE1F5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3E93C092-0E42-4200-B71A-5EEE410FE1F5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -102,8 +86,6 @@ Global {5F7DA2C5-B908-4B57-9F5F-BADF1216D89C} = {38BA087F-EDA1-4F8A-A140-85B84791B815} {590908DF-A813-467A-94E4-3500020D0D54} = {38BA087F-EDA1-4F8A-A140-85B84791B815} {1EA000E4-6103-4577-8D98-BDDA3BE458A2} = {38BA087F-EDA1-4F8A-A140-85B84791B815} - {38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3} = {ED3DA9DD-1E07-444B-A2D7-2DBA280F96D4} - {3E93C092-0E42-4200-B71A-5EEE410FE1F5} = {38BA087F-EDA1-4F8A-A140-85B84791B815} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {585F071D-051D-441C-9C6B-226D9E15A1F5} diff --git a/src-examples/ConsoleAppIHttpClient/ConsoleAppIHttpClient.csproj b/src-examples/ConsoleAppIHttpClient/ConsoleAppIHttpClient.csproj deleted file mode 100644 index a0ada3d..0000000 --- a/src-examples/ConsoleAppIHttpClient/ConsoleAppIHttpClient.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - Exe - net8.0 - enable - - - - - - - diff --git a/src-examples/ConsoleAppIHttpClient/Program.cs b/src-examples/ConsoleAppIHttpClient/Program.cs deleted file mode 100644 index 78b4f49..0000000 --- a/src-examples/ConsoleAppIHttpClient/Program.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Net.Http; -using System.Net.Http.Json; - -var httpClient = new HttpClient(); -var httpClientProxy = new HttpClientProxy(httpClient); - -var result = await httpClientProxy.GetAsync("https://www.google.nl"); -var todo = await httpClientProxy.GetFromJsonAsync("https://jsonplaceholder.typicode.com/todos/1"); -var postResult = await httpClientProxy.PostAsJsonAsync("https://jsonplaceholder.typicode.com/todos", new Todo { Id = 123 }); -var patchResult = await httpClientProxy.PatchAsJsonAsync("https://jsonplaceholder.typicode.com/todos/1", new Todo { Id = 400 }); -var putResult = await httpClientProxy.PutAsJsonAsync("https://jsonplaceholder.typicode.com/todos/1", new Todo { Id = 444 }); - -int x = 0; \ No newline at end of file diff --git a/src-examples/ConsoleAppIHttpClient/Todo.cs b/src-examples/ConsoleAppIHttpClient/Todo.cs deleted file mode 100644 index 158af1b..0000000 --- a/src-examples/ConsoleAppIHttpClient/Todo.cs +++ /dev/null @@ -1,4 +0,0 @@ -public class Todo -{ - public int Id { get; set; } -} \ No newline at end of file diff --git a/src/IHttpClient/IHttpClient.cs b/src/IHttpClient/IHttpClient.cs deleted file mode 100644 index f7cc9fd..0000000 --- a/src/IHttpClient/IHttpClient.cs +++ /dev/null @@ -1,7 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace System.Net.Http; - -[ProxyInterfaceGenerator.Proxy(typeof(HttpClient), true)] -public partial interface IHttpClient : IHttpMessageInvoker -{ -} \ No newline at end of file diff --git a/src/IHttpClient/IHttpClient.csproj b/src/IHttpClient/IHttpClient.csproj deleted file mode 100644 index fc16786..0000000 --- a/src/IHttpClient/IHttpClient.csproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - 0.0.1 - netstandard2.1;net6.0;net7.0;net8.0 - enable - latest - {38C2BB6E-EE23-4C4F-B8D5-A2AD592DE5E3} - Stef Heyenrath - - IHttpClient - IHttpClient - This project uses source generation to generate an IHttpClient interface and HttpClientProxy from the HttpClient to make it injectable and unit-testable. - HttpClient;interface;IHttpClient;Proxy;HttpClientProxy - MIT - - https://github.com/StefH/ProxyInterfaceSourceGenerator/src/IHttpClient - git - https://github.com/StefH/ProxyInterfaceSourceGenerator/src/IHttpClient - Readme.md - ihttpclient-icon.png - - - - - true - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - \ No newline at end of file diff --git a/src/IHttpClient/IHttpClientJsonExtensions.cs b/src/IHttpClient/IHttpClientJsonExtensions.cs deleted file mode 100644 index 3a55272..0000000 --- a/src/IHttpClient/IHttpClientJsonExtensions.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Text.Json.Serialization.Metadata; -using System.Threading; -using System.Threading.Tasks; - -// ReSharper disable once CheckNamespace -namespace System.Net.Http.Json; - -/// -public static class IHttpClientJsonExtensions -{ - #region PostAsJsonAsync - public static Task PostAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) - { - return client._Instance.PostAsJsonAsync(requestUri, value, options, cancellationToken); - } - - public static Task PostAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) - { - return client._Instance.PostAsJsonAsync(requestUri, value, options, cancellationToken); - } - - public static Task PostAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, CancellationToken cancellationToken) - { - return client._Instance.PostAsJsonAsync(requestUri, value, options: null, cancellationToken); - } - - public static Task PostAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, CancellationToken cancellationToken) - { - return client._Instance.PostAsJsonAsync(requestUri, value, options: null, cancellationToken); - } - - public static Task PostAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken = default) - { - return client._Instance.PostAsJsonAsync(requestUri, value, jsonTypeInfo, cancellationToken); - } - - public static Task PostAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken = default) - { - return client._Instance.PostAsJsonAsync(requestUri, value, jsonTypeInfo, cancellationToken); - } - #endregion - -#if NET7_0_OR_GREATER - #region PatchAsJsonAsync - public static Task PatchAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) - { - return client._Instance.PatchAsJsonAsync(requestUri, value, options, cancellationToken); - } - - public static Task PatchAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) - { - return client._Instance.PatchAsJsonAsync(requestUri, value, options, cancellationToken); - } - - public static Task PatchAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, CancellationToken cancellationToken) - { - return client._Instance.PatchAsJsonAsync(requestUri, value, cancellationToken); - } - - public static Task PatchAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, CancellationToken cancellationToken) - { - return client._Instance.PatchAsJsonAsync(requestUri, value, cancellationToken); - } - - public static Task PatchAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken = default) - { - return client._Instance.PatchAsJsonAsync(requestUri, value, jsonTypeInfo, cancellationToken); - } - - public static Task PatchAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken = default) - { - return client._Instance.PatchAsJsonAsync(requestUri, value, jsonTypeInfo, cancellationToken); - } -#endregion -#endif - - #region PutAsJsonAsync - public static Task PutAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) - { - return client._Instance.PutAsJsonAsync(requestUri, value, options, cancellationToken); - } - - public static Task PutAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) - { - return client._Instance.PutAsJsonAsync(requestUri, value, options, cancellationToken); - } - - public static Task PutAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, CancellationToken cancellationToken) - { - return client._Instance.PutAsJsonAsync(requestUri, value, cancellationToken); - } - - public static Task PutAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, CancellationToken cancellationToken) - { - return client._Instance.PutAsJsonAsync(requestUri, value, cancellationToken); - } - - public static Task PutAsJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken = default) - { - return client._Instance.PutAsJsonAsync(requestUri, value, jsonTypeInfo, cancellationToken); - } - - public static Task PutAsJsonAsync(this IHttpClient client, Uri? requestUri, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken = default) - { - return client._Instance.PutAsJsonAsync(requestUri, value, jsonTypeInfo, cancellationToken); - } - #endregion - - #region GetFromJsonAsync - public static Task GetFromJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, type, options, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, Uri? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, type, options, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, JsonSerializerOptions? options, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, options, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, Uri? requestUri, JsonSerializerOptions? options, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, options, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, type, context, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, Uri? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, type, context, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, jsonTypeInfo, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, Uri? requestUri, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, jsonTypeInfo, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, type, options: null, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, Uri? requestUri, Type type, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, type, options: null, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, cancellationToken); - } - - public static Task GetFromJsonAsync(this IHttpClient client, Uri? requestUri, CancellationToken cancellationToken = default) - { - return client._Instance.GetFromJsonAsync(requestUri, cancellationToken); - } - #endregion -} \ No newline at end of file diff --git a/src/IHttpClient/IHttpMessageInvoker.cs b/src/IHttpClient/IHttpMessageInvoker.cs deleted file mode 100644 index 67d7c10..0000000 --- a/src/IHttpClient/IHttpMessageInvoker.cs +++ /dev/null @@ -1,7 +0,0 @@ -// ReSharper disable once CheckNamespace -namespace System.Net.Http; - -[ProxyInterfaceGenerator.Proxy(typeof(HttpMessageInvoker))] -public partial interface IHttpMessageInvoker -{ -} \ No newline at end of file diff --git a/src/IHttpClient/Readme.md b/src/IHttpClient/Readme.md deleted file mode 100644 index 970a611..0000000 --- a/src/IHttpClient/Readme.md +++ /dev/null @@ -1,16 +0,0 @@ -## Info -This project uses source generation to generate an `IHttpClient` interface and `HttpClientProxy` from the `HttpClient` to make it injectable and unit-testable. - -All the methods and properties from the `HttpClient` are replicated to `IHttpClient`. - -## Usage -``` c# -HttpClient httpClient = new HttpClient(); -IHttpClient httpClientProxy = new HttpClientProxy(httpClient); - -var result = await httpClientProxy.GetAsync("https://www.google.nl"); -var todo = await httpClientProxy.GetFromJsonAsync("https://jsonplaceholder.typicode.com/todos/1"); -var postResult = await httpClientProxy.PostAsJsonAsync("https://jsonplaceholder.typicode.com/todos", new Todo { Id = 123 }); -var patchResult = await httpClientProxy.PatchAsJsonAsync("https://jsonplaceholder.typicode.com/todos/1", new Todo { Id = 400 }); -var putResult = await httpClientProxy.PutAsJsonAsync("https://jsonplaceholder.typicode.com/todos/1", new Todo { Id = 444 }); -``` \ No newline at end of file diff --git a/tests/ProxyInterfaceSourceGeneratorTests/Destination/AkkaGenerated/ProxyInterfaceSourceGeneratorTests.Source.AkkaActor.ILocalActorRefProvider.g.cs b/tests/ProxyInterfaceSourceGeneratorTests/Destination/AkkaGenerated/ProxyInterfaceSourceGeneratorTests.Source.AkkaActor.ILocalActorRefProvider.g.cs index a4b2173..7e37a8a 100644 --- a/tests/ProxyInterfaceSourceGeneratorTests/Destination/AkkaGenerated/ProxyInterfaceSourceGeneratorTests.Source.AkkaActor.ILocalActorRefProvider.g.cs +++ b/tests/ProxyInterfaceSourceGeneratorTests/Destination/AkkaGenerated/ProxyInterfaceSourceGeneratorTests.Source.AkkaActor.ILocalActorRefProvider.g.cs @@ -12,62 +12,18 @@ using System; namespace ProxyInterfaceSourceGeneratorTests.Source.AkkaActor { - public partial interface ILocalActorRefProvider + public partial interface ILocalActorRefProvider : global::Akka.Actor.IActorRefProvider { Akka.Actor.LocalActorRefProvider _Instance { get; } - Akka.Actor.IActorRef DeadLetters { get; } - - Akka.Actor.IActorRef IgnoreRef { get; } - - Akka.Actor.Deployer Deployer { get; } - - Akka.Actor.IInternalActorRef RootGuardian { get; } - - Akka.Actor.ActorPath RootPath { get; } - - Akka.Actor.Settings Settings { get; } - - Akka.Actor.LocalActorRef SystemGuardian { get; } - - Akka.Actor.IInternalActorRef TempContainer { get; } - - System.Threading.Tasks.Task TerminationTask { get; } - - Akka.Actor.LocalActorRef Guardian { get; } - Akka.Event.EventStream EventStream { get; } - Akka.Actor.Address DefaultAddress { get; } - - Akka.Serialization.Information SerializationInformation { get; } - Akka.Event.ILoggingAdapter Log { get; } - Akka.Actor.ActorPath TempPath(); - void RegisterExtraName(string name, Akka.Actor.IInternalActorRef actor); - Akka.Actor.IActorRef RootGuardianAt(Akka.Actor.Address address); - - void RegisterTempActor(Akka.Actor.IInternalActorRef actorRef, Akka.Actor.ActorPath path); - - void UnregisterTempActor(Akka.Actor.ActorPath path); - - Akka.Actor.FutureActorRef CreateFutureRef(System.Threading.Tasks.TaskCompletionSource tcs); - - void Init(Akka.Actor.Internal.ActorSystemImpl system); - - Akka.Actor.IActorRef ResolveActorRef(string path); - - Akka.Actor.IActorRef ResolveActorRef(Akka.Actor.ActorPath path); - - Akka.Actor.IInternalActorRef ActorOf(Akka.Actor.Internal.ActorSystemImpl system, Akka.Actor.Props props, Akka.Actor.IInternalActorRef supervisor, Akka.Actor.ActorPath path, bool systemService, Akka.Actor.Deploy deploy, bool lookupDeploy, bool @async); - - Akka.Actor.Address GetExternalAddressFor(Akka.Actor.Address address); - diff --git a/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.IHttpClient.g.cs b/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.IHttpClient.g.cs index 1ec8623..b4b4d63 100644 --- a/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.IHttpClient.g.cs +++ b/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.IHttpClient.g.cs @@ -32,75 +32,75 @@ namespace ProxyInterfaceSourceGeneratorTests.Source - System.Threading.Tasks.Task GetStringAsync(string? requestUri); + System.Threading.Tasks.Task GetStringAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri); System.Threading.Tasks.Task GetStringAsync(System.Uri? requestUri); - System.Threading.Tasks.Task GetStringAsync(string? requestUri, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task GetStringAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task GetStringAsync(System.Uri? requestUri, System.Threading.CancellationToken cancellationToken); - System.Threading.Tasks.Task GetByteArrayAsync(string? requestUri); + System.Threading.Tasks.Task GetByteArrayAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri); System.Threading.Tasks.Task GetByteArrayAsync(System.Uri? requestUri); - System.Threading.Tasks.Task GetByteArrayAsync(string? requestUri, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task GetByteArrayAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task GetByteArrayAsync(System.Uri? requestUri, System.Threading.CancellationToken cancellationToken); - System.Threading.Tasks.Task GetStreamAsync(string? requestUri); + System.Threading.Tasks.Task GetStreamAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri); - System.Threading.Tasks.Task GetStreamAsync(string? requestUri, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task GetStreamAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task GetStreamAsync(System.Uri? requestUri); System.Threading.Tasks.Task GetStreamAsync(System.Uri? requestUri, System.Threading.CancellationToken cancellationToken); - System.Threading.Tasks.Task GetAsync(string? requestUri); + System.Threading.Tasks.Task GetAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri); System.Threading.Tasks.Task GetAsync(System.Uri? requestUri); - System.Threading.Tasks.Task GetAsync(string? requestUri, System.Net.Http.HttpCompletionOption completionOption); + System.Threading.Tasks.Task GetAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpCompletionOption completionOption); System.Threading.Tasks.Task GetAsync(System.Uri? requestUri, System.Net.Http.HttpCompletionOption completionOption); - System.Threading.Tasks.Task GetAsync(string? requestUri, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task GetAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task GetAsync(System.Uri? requestUri, System.Threading.CancellationToken cancellationToken); - System.Threading.Tasks.Task GetAsync(string? requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task GetAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task GetAsync(System.Uri? requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken); - System.Threading.Tasks.Task PostAsync(string? requestUri, System.Net.Http.HttpContent? content); + System.Threading.Tasks.Task PostAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content); System.Threading.Tasks.Task PostAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content); - System.Threading.Tasks.Task PostAsync(string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task PostAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task PostAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); - System.Threading.Tasks.Task PutAsync(string? requestUri, System.Net.Http.HttpContent? content); + System.Threading.Tasks.Task PutAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content); System.Threading.Tasks.Task PutAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content); - System.Threading.Tasks.Task PutAsync(string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task PutAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task PutAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); - System.Threading.Tasks.Task PatchAsync(string? requestUri, System.Net.Http.HttpContent? content); + System.Threading.Tasks.Task PatchAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content); System.Threading.Tasks.Task PatchAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content); - System.Threading.Tasks.Task PatchAsync(string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task PatchAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task PatchAsync(System.Uri? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken); - System.Threading.Tasks.Task DeleteAsync(string? requestUri); + System.Threading.Tasks.Task DeleteAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri); System.Threading.Tasks.Task DeleteAsync(System.Uri? requestUri); - System.Threading.Tasks.Task DeleteAsync(string? requestUri, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task DeleteAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken); System.Threading.Tasks.Task DeleteAsync(System.Uri? requestUri, System.Threading.CancellationToken cancellationToken); diff --git a/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.IHttpMessageInvoker.g.cs b/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.IHttpMessageInvoker.g.cs index 2bdd002..73d6c6e 100644 --- a/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.IHttpMessageInvoker.g.cs +++ b/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.IHttpMessageInvoker.g.cs @@ -12,7 +12,7 @@ using System; namespace ProxyInterfaceSourceGeneratorTests.Source { - public partial interface IHttpMessageInvoker + public partial interface IHttpMessageInvoker : global::System.IDisposable { System.Net.Http.HttpMessageInvoker _Instance { get; } @@ -23,8 +23,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken); - void Dispose(); - diff --git a/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject.g.cs b/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject.g.cs index 494d27d..8267135 100644 --- a/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject.g.cs +++ b/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject.g.cs @@ -12,7 +12,7 @@ using System; namespace ProxyInterfaceSourceGeneratorTests.Source.PnP { - public partial interface IClientObject + public partial interface IClientObject : global::Microsoft.SharePoint.Client.IFromJson { Microsoft.SharePoint.Client.ClientObject _Instance { get; } @@ -33,12 +33,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - void FromJson(Microsoft.SharePoint.Client.JsonReader reader); - - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - bool CustomFromJson(Microsoft.SharePoint.Client.JsonReader reader); - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] void Retrieve(); diff --git a/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext.g.cs b/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext.g.cs index 2741fe3..3893c73 100644 --- a/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext.g.cs +++ b/tests/ProxyInterfaceSourceGeneratorTests/Destination/ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext.g.cs @@ -12,7 +12,7 @@ using System; namespace ProxyInterfaceSourceGeneratorTests.Source.PnP { - public partial interface IClientRuntimeContext + public partial interface IClientRuntimeContext : global::System.IDisposable { Microsoft.SharePoint.Client.ClientRuntimeContext _Instance { get; } @@ -77,8 +77,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP System.Collections.Generic.IEnumerable LoadQuery(System.Linq.IQueryable clientObjects) where T : Microsoft.SharePoint.Client.ClientObject; - void Dispose(); - event System.EventHandler ExecutingWebRequest; diff --git a/tests/ProxyInterfaceSourceGeneratorTests/Destination/System.Net.Http.HttpClientProxy.g.cs b/tests/ProxyInterfaceSourceGeneratorTests/Destination/System.Net.Http.HttpClientProxy.g.cs index 7d41b8b..80b852c 100644 --- a/tests/ProxyInterfaceSourceGeneratorTests/Destination/System.Net.Http.HttpClientProxy.g.cs +++ b/tests/ProxyInterfaceSourceGeneratorTests/Destination/System.Net.Http.HttpClientProxy.g.cs @@ -33,7 +33,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source - public System.Threading.Tasks.Task GetStringAsync(string? requestUri) + public System.Threading.Tasks.Task GetStringAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri) { string? requestUri_ = requestUri; var result_1347886741 = _Instance.GetStringAsync(requestUri_); @@ -47,7 +47,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_1347886741; } - public System.Threading.Tasks.Task GetStringAsync(string? requestUri, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task GetStringAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Threading.CancellationToken cancellationToken_ = cancellationToken; @@ -63,7 +63,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_1347886741; } - public System.Threading.Tasks.Task GetByteArrayAsync(string? requestUri) + public System.Threading.Tasks.Task GetByteArrayAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri) { string? requestUri_ = requestUri; var result__1359336953 = _Instance.GetByteArrayAsync(requestUri_); @@ -77,7 +77,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result__1359336953; } - public System.Threading.Tasks.Task GetByteArrayAsync(string? requestUri, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task GetByteArrayAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Threading.CancellationToken cancellationToken_ = cancellationToken; @@ -93,14 +93,14 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result__1359336953; } - public System.Threading.Tasks.Task GetStreamAsync(string? requestUri) + public System.Threading.Tasks.Task GetStreamAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri) { string? requestUri_ = requestUri; var result_355326142 = _Instance.GetStreamAsync(requestUri_); return result_355326142; } - public System.Threading.Tasks.Task GetStreamAsync(string? requestUri, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task GetStreamAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Threading.CancellationToken cancellationToken_ = cancellationToken; @@ -123,7 +123,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_355326142; } - public System.Threading.Tasks.Task GetAsync(string? requestUri) + public System.Threading.Tasks.Task GetAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri) { string? requestUri_ = requestUri; var result_1805284658 = _Instance.GetAsync(requestUri_); @@ -137,7 +137,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_1805284658; } - public System.Threading.Tasks.Task GetAsync(string? requestUri, System.Net.Http.HttpCompletionOption completionOption) + public System.Threading.Tasks.Task GetAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpCompletionOption completionOption) { string? requestUri_ = requestUri; System.Net.Http.HttpCompletionOption completionOption_ = completionOption; @@ -153,7 +153,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_1805284658; } - public System.Threading.Tasks.Task GetAsync(string? requestUri, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task GetAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Threading.CancellationToken cancellationToken_ = cancellationToken; @@ -169,7 +169,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_1805284658; } - public System.Threading.Tasks.Task GetAsync(string? requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task GetAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Net.Http.HttpCompletionOption completionOption_ = completionOption; @@ -187,7 +187,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_1805284658; } - public System.Threading.Tasks.Task PostAsync(string? requestUri, System.Net.Http.HttpContent? content) + public System.Threading.Tasks.Task PostAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content) { string? requestUri_ = requestUri; System.Net.Http.HttpContent? content_ = content; @@ -203,7 +203,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result__1705712948; } - public System.Threading.Tasks.Task PostAsync(string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task PostAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Net.Http.HttpContent? content_ = content; @@ -221,7 +221,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result__1705712948; } - public System.Threading.Tasks.Task PutAsync(string? requestUri, System.Net.Http.HttpContent? content) + public System.Threading.Tasks.Task PutAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content) { string? requestUri_ = requestUri; System.Net.Http.HttpContent? content_ = content; @@ -237,7 +237,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_182918739; } - public System.Threading.Tasks.Task PutAsync(string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task PutAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Net.Http.HttpContent? content_ = content; @@ -255,7 +255,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_182918739; } - public System.Threading.Tasks.Task PatchAsync(string? requestUri, System.Net.Http.HttpContent? content) + public System.Threading.Tasks.Task PatchAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content) { string? requestUri_ = requestUri; System.Net.Http.HttpContent? content_ = content; @@ -271,7 +271,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_910894592; } - public System.Threading.Tasks.Task PatchAsync(string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task PatchAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Net.Http.HttpContent? content, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Net.Http.HttpContent? content_ = content; @@ -289,7 +289,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_910894592; } - public System.Threading.Tasks.Task DeleteAsync(string? requestUri) + public System.Threading.Tasks.Task DeleteAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri) { string? requestUri_ = requestUri; var result_534537427 = _Instance.DeleteAsync(requestUri_); @@ -303,7 +303,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source return result_534537427; } - public System.Threading.Tasks.Task DeleteAsync(string? requestUri, System.Threading.CancellationToken cancellationToken) + public System.Threading.Tasks.Task DeleteAsync([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("Uri")] string? requestUri, System.Threading.CancellationToken cancellationToken) { string? requestUri_ = requestUri; System.Threading.CancellationToken cancellationToken_ = cancellationToken;