Skip to content

Commit 367838e

Browse files
test: add unsupported return type test (#1963)
1 parent 4e28ed9 commit 367838e

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

Diff for: Refit.GeneratorTests/ReturnTypeTests.cs

+10
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,14 @@ public Task ReturnIObservable()
8181
IObservable<HttpResponseMessage> GetUser(string user);
8282
""");
8383
}
84+
85+
[Fact]
86+
public Task ReturnUnsupportedType()
87+
{
88+
return Fixture.VerifyForBody(
89+
"""
90+
[Get("/users/{user}")]
91+
string GetUser(string user);
92+
""");
93+
}
8494
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//HintName: IGeneratedClient.g.cs
2+
#nullable disable
3+
#pragma warning disable
4+
namespace Refit.Implementation
5+
{
6+
7+
partial class Generated
8+
{
9+
10+
/// <inheritdoc />
11+
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
12+
[global::System.Diagnostics.DebuggerNonUserCode]
13+
[global::RefitInternalGenerated.PreserveAttribute]
14+
[global::System.Reflection.Obfuscation(Exclude=true)]
15+
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
16+
partial class RefitGeneratorTestIGeneratedClient
17+
: global::RefitGeneratorTest.IGeneratedClient
18+
19+
{
20+
/// <inheritdoc />
21+
public global::System.Net.Http.HttpClient Client { get; }
22+
readonly global::Refit.IRequestBuilder requestBuilder;
23+
24+
/// <inheritdoc />
25+
public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)
26+
{
27+
Client = client;
28+
this.requestBuilder = requestBuilder;
29+
}
30+
31+
32+
private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(string) };
33+
34+
/// <inheritdoc />
35+
public string GetUser(string @user)
36+
{
37+
var ______arguments = new object[] { @user };
38+
var ______func = requestBuilder.BuildRestResultFuncForMethod("GetUser", ______typeParameters );
39+
40+
return (string)______func(this.Client, ______arguments);
41+
}
42+
43+
private static readonly global::System.Type[] ______typeParameters0 = new global::System.Type[] {typeof(string) };
44+
45+
/// <inheritdoc />
46+
string global::RefitGeneratorTest.IGeneratedClient.GetUser(string @user)
47+
{
48+
var ______arguments = new object[] { @user };
49+
var ______func = requestBuilder.BuildRestResultFuncForMethod("GetUser", ______typeParameters0 );
50+
51+
return (string)______func(this.Client, ______arguments);
52+
}
53+
}
54+
}
55+
}
56+
57+
#pragma warning restore

0 commit comments

Comments
 (0)