diff --git a/Refit.GeneratorTests/ReturnTypeTests.cs b/Refit.GeneratorTests/ReturnTypeTests.cs index 01849f412..640c1c7e2 100644 --- a/Refit.GeneratorTests/ReturnTypeTests.cs +++ b/Refit.GeneratorTests/ReturnTypeTests.cs @@ -81,4 +81,14 @@ public Task ReturnIObservable() IObservable GetUser(string user); """); } + + [Fact] + public Task ReturnUnsupportedType() + { + return Fixture.VerifyForBody( + """ + [Get("/users/{user}")] + string GetUser(string user); + """); + } } diff --git a/Refit.GeneratorTests/_snapshots/ReturnTypeTests.ReturnUnsupportedType#IGeneratedClient.g.verified.cs b/Refit.GeneratorTests/_snapshots/ReturnTypeTests.ReturnUnsupportedType#IGeneratedClient.g.verified.cs new file mode 100644 index 000000000..c136b2f65 --- /dev/null +++ b/Refit.GeneratorTests/_snapshots/ReturnTypeTests.ReturnUnsupportedType#IGeneratedClient.g.verified.cs @@ -0,0 +1,57 @@ +//HintName: IGeneratedClient.g.cs +#nullable disable +#pragma warning disable +namespace Refit.Implementation +{ + + partial class Generated + { + + /// + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::System.Diagnostics.DebuggerNonUserCode] + [global::RefitInternalGenerated.PreserveAttribute] + [global::System.Reflection.Obfuscation(Exclude=true)] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + partial class RefitGeneratorTestIGeneratedClient + : global::RefitGeneratorTest.IGeneratedClient + + { + /// + public global::System.Net.Http.HttpClient Client { get; } + readonly global::Refit.IRequestBuilder requestBuilder; + + /// + public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder) + { + Client = client; + this.requestBuilder = requestBuilder; + } + + + private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(string) }; + + /// + public string GetUser(string @user) + { + var ______arguments = new object[] { @user }; + var ______func = requestBuilder.BuildRestResultFuncForMethod("GetUser", ______typeParameters ); + + return (string)______func(this.Client, ______arguments); + } + + private static readonly global::System.Type[] ______typeParameters0 = new global::System.Type[] {typeof(string) }; + + /// + string global::RefitGeneratorTest.IGeneratedClient.GetUser(string @user) + { + var ______arguments = new object[] { @user }; + var ______func = requestBuilder.BuildRestResultFuncForMethod("GetUser", ______typeParameters0 ); + + return (string)______func(this.Client, ______arguments); + } + } + } +} + +#pragma warning restore