Skip to content

Commit 0f33b04

Browse files
committed
WIP
1 parent f58c160 commit 0f33b04

3 files changed

Lines changed: 5 additions & 21 deletions

File tree

src/NSwag.CodeGeneration.CSharp.Tests/CSharpClientSettingsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ namespace MyNamespace
8787
public class MyBaseClass
8888
{
8989
public MyBaseClass(MyConfig configuration) {}
90+
protected global::System.Threading.Tasks.Task<global::System.Net.Http.HttpRequestMessage> CreateHttpRequestMessageAsync(global::System.Threading.CancellationToken ct) { return default; }
9091
}
9192
public class MyConfig {}
9293
}");

src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
{% endif -%}
2323

2424
{% assign constructorParameters = "" -%}
25-
{% if HasConfigurationClass -%}
26-
{% assign constructorParameters = ConfigurationClass | append: " configuration" -%}
25+
{% if UseBaseUrl and HasBaseUrl == false -%}
26+
{% assign constructorParameters = "string baseUrl" %}
2727
{% endif -%}
28-
{% if UseBaseUrl and HasBaseUrl == false and HasConfigurationClass == false -%}
28+
{% if HasConfigurationClass -%}
2929
{% unless constructorParameters == "" -%}{% assign constructorParameters = constructorParameters | append: ", " -%}{% endunless -%}
30-
{% assign constructorParameters = constructorParameters | append: "string baseUrl" -%}
30+
{% assign constructorParameters = constructorParameters | append: ConfigurationClass | append: " configuration" -%}
3131
{% endif -%}
3232
{% if InjectHttpClient -%}
3333
{% unless constructorParameters == "" -%}{% assign constructorParameters = constructorParameters | append: ", " -%}{% endunless -%}

src/NSwag.CodeGeneration.Tests/VerifyHelper.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,4 @@ public static SettingsTask Verify(string output, bool scrubPragmas = true, bool
4343
.UseDirectory("Snapshots")
4444
.AutoVerify(includeBuildServer: false);
4545
}
46-
47-
/// <summary>
48-
/// Constructs a namespace-like identifier based on the caller's file name (without extension) and the caller member name.
49-
/// </summary>
50-
/// <param name="sourceMethod">
51-
/// The caller member name populated by the compiler via <see cref="CallerMemberNameAttribute"/>.
52-
/// </param>
53-
/// <param name="sourceFile">
54-
/// The caller file path populated by the compiler via <see cref="CallerFilePathAttribute"/>.
55-
/// </param>
56-
/// <returns>
57-
/// A string in the format "<c>{FileNameWithoutExtension}.{MemberName}</c>" (e.g. <c>MyTests.TestMethod</c>).
58-
/// </returns>
59-
public static string GetNameSpace([CallerMemberName] string sourceMethod = "", [CallerFilePath] string sourceFile = "")
60-
{
61-
return $"{Path.GetFileNameWithoutExtension(sourceFile)}.{sourceMethod}";
62-
}
6346
}

0 commit comments

Comments
 (0)