Skip to content

Commit c5e58ca

Browse files
committed
Fix tests
1 parent e9db800 commit c5e58ca

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/Cli/func/Actions/HostActions/StartHostAction.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ void ThrowCliException(string suffix)
546546

547547
if (string.Equals(HostRuntime, "default", StringComparison.OrdinalIgnoreCase))
548548
{
549-
ThrowCliException($"The provided value is only valid for the worker runtime '{WorkerRuntime.DotnetIsolated}'.");
549+
ThrowCliException($"The provided value is only valid for the worker runtime '{WorkerRuntime.DotnetIsolated.ToString().ToLowerInvariant}'.");
550550
}
551551

552552
if (isInproc8ArgumentValue && !await validateDotNet8ProjectEnablement())
@@ -560,7 +560,7 @@ void ThrowCliException(string suffix)
560560
}
561561
else if (isInproc8ArgumentValue || isInproc6ArgumentValue)
562562
{
563-
ThrowCliException($"The provided value is only valid for the worker runtime '{WorkerRuntime.Dotnet}'.");
563+
ThrowCliException($"The provided value is only valid for the worker runtime '{WorkerRuntime.Dotnet.ToString().ToLowerInvariant}'.");
564564
}
565565

566566
PrintVerboseForHostSelection(HostRuntime);

src/Cli/func/Actions/LocalActions/InitAction.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private async Task InitFunctionAppProject()
199199
if (!supportedProgrammingModels.Contains(ResolvedProgrammingModel))
200200
{
201201
throw new CliArgumentsException(
202-
$"The {ResolvedProgrammingModel.ToString()} programming model is not supported for worker runtime {ResolvedWorkerRuntime.ToString()}. Supported programming models for worker runtime {ResolvedWorkerRuntime.ToString()} are:\n{EnumerationHelper.Join<ProgrammingModel>("\n", supportedProgrammingModels)}");
202+
$"The {ResolvedProgrammingModel.ToString().ToLowerInvariant} programming model is not supported for worker runtime {ResolvedWorkerRuntime.ToString().ToLowerInvariant}. Supported programming models for worker runtime {ResolvedWorkerRuntime.ToString().ToLowerInvariant} are:\n{EnumerationHelper.Join("\n", supportedProgrammingModels)}");
203203
}
204204
}
205205

@@ -367,7 +367,7 @@ private void ValidateTargetFramework()
367367

368368
if (!supportedFrameworks.Contains(TargetFramework, StringComparer.InvariantCultureIgnoreCase))
369369
{
370-
throw new CliArgumentsException($"Unable to parse target framework {TargetFramework} for worker runtime {ResolvedWorkerRuntime}. Valid options are {string.Join(", ", supportedFrameworks)}");
370+
throw new CliArgumentsException($"Unable to parse target framework {TargetFramework} for worker runtime {ResolvedWorkerRuntime.ToString().ToLowerInvariant}. Valid options are {string.Join(", ", supportedFrameworks)}");
371371
}
372372
else if (ResolvedWorkerRuntime != Helpers.WorkerRuntime.DotnetIsolated && ResolvedWorkerRuntime != Helpers.WorkerRuntime.Dotnet)
373373
{

src/Cli/func/Extensions/GenericExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static TTarget MergeWith<TTarget, TSource, TSelected>(this TTarget target
1414
{
1515
object selectedSource = null;
1616

17-
if (source is null && selector is not null)
17+
if (source != null && selector != null)
1818
{
1919
selectedSource = selector(source);
2020
}

test/Azure.Functions.Cli.Tests/E2E/StartTests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ await CliTester.Run(new RunConfiguration[]
257257
p.Kill();
258258
await Task.Delay(TimeSpan.FromSeconds(2));
259259
result.Should().Be("Hello, Test. This HTTP triggered function executed successfully.", because: "response from default function should be 'Hello, {name}. This HTTP triggered function executed successfully.'");
260-
260+
261261
if (_output is Xunit.Sdk.TestOutputHelper testOutputHelper)
262262
{
263263
testOutputHelper.Output.Should().Contain($".NET 6 is no longer supported. Please consider migrating to a supported version. For more information, see https://aka.ms/azure-functions/dotnet/net8-in-process. If you intend to target .NET 8 on the in-process model, make sure that '{Constants.InProcDotNet8EnabledSetting}' is set to '1' in {Constants.LocalSettingsJsonFileName}.");
@@ -1115,7 +1115,7 @@ await CliTester.Run(new RunConfiguration[]
11151115
},
11161116
ExpectExit = false,
11171117
ExitInError = true,
1118-
ErrorContains = ["The runtime argument value provided, 'default', is invalid. The provided value is only valid for the worker runtime 'dotnetIsolated'."],
1118+
ErrorContains = ["The runtime argument value provided, 'default', is invalid. The provided value is only valid for the worker runtime 'dotnetisolated'."],
11191119
Test = async (workingDir, p, _) =>
11201120
{
11211121
using (var client = new HttpClient() { BaseAddress = new Uri($"http://localhost:{_funcHostPort}") })
@@ -1149,7 +1149,7 @@ await CliTester.Run(new RunConfiguration[]
11491149
},
11501150
ExpectExit = false,
11511151
ExitInError = true,
1152-
ErrorContains = ["The runtime argument value provided, 'default', is invalid. The provided value is only valid for the worker runtime 'dotnetIsolated'."],
1152+
ErrorContains = ["The runtime argument value provided, 'default', is invalid. The provided value is only valid for the worker runtime 'dotnetisolated'."],
11531153
Test = async (workingDir, p, _) =>
11541154
{
11551155
using (var client = new HttpClient() { BaseAddress = new Uri($"http://localhost:{_funcHostPort}") })
@@ -1896,7 +1896,7 @@ await CliTester.Run(new RunConfiguration[]
18961896
var response = await client.GetAsync("/api/HttpTrigger?name=Test");
18971897
var result = await response.Content.ReadAsStringAsync();
18981898
p.Kill();
1899-
1899+
19001900
if (_output is Xunit.Sdk.TestOutputHelper testOutputHelper)
19011901
{
19021902
testOutputHelper.Output.Should().Contain($".NET 6 is no longer supported. Please consider migrating to a supported version. For more information, see https://aka.ms/azure-functions/dotnet/net8-in-process. If you intend to target .NET 8 on the in-process model, make sure that '{Constants.InProcDotNet8EnabledSetting}' is set to '1' in {Constants.LocalSettingsJsonFileName}.");
@@ -1965,4 +1965,4 @@ public async Task DisposeAsync()
19651965
await Task.CompletedTask;
19661966
}
19671967
}
1968-
}
1968+
}

0 commit comments

Comments
 (0)