Skip to content

Commit 6285798

Browse files
authored
Upgraded to net8, throw exception in Program.cs, ignore --http_ports command input (#29)
1 parent 8ba629d commit 6285798

File tree

6 files changed

+15
-19
lines changed

6 files changed

+15
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dotnet test .\netmockery.sln
1515

1616
In linux container
1717
```
18-
docker run --rm -v ${PWD}\:/mnt/repo/ -w /mnt/repo mcr.microsoft.com/dotnet/sdk:6.0 dotnet test .\netmockery.sln
18+
docker run --rm -v ${PWD}\:/mnt/repo/ -w /mnt/repo mcr.microsoft.com/dotnet/sdk:8.0 dotnet test .\netmockery.sln
1919
```
2020

2121
RUNNING

UnitTests/UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net6.0</TargetFramework>
3+
<TargetFramework>net8.0</TargetFramework>
44
<IsPublishable>false</IsPublishable>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>

netmockery.globals/netmockery.globals.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

netmockery/CommandLineParser.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ static public class CommandLineParser
2525
private const string BOOL_SWITCH_DIFF = "--diff";
2626
private const string BOOL_SWITCH_LIST = "--list";
2727

28+
static private string[] VALUE_SWICTHES_IGNORED = new[] { "--http_ports" }; // Not used, ports are part of urls
2829
static private string[] VALUE_SWITCHES = new[] { VALUE_SWITCH_ENDPOINTS, VALUE_SWITCH_URLS, VALUE_SWITCH_ONLY, VALUE_UT_SWITCH_ENVIRONMENT, VALUE_UT_SWITCH_CONTENTROOT, VALUE_UT_SWITCH_APPLICATIONNAME };
2930
static private string[] BOOL_SWITCHES = new[] { BOOL_SWITCH_SHOWRESPONSE, BOOL_SWITCH_NOTESTMODE, BOOL_SWITCH_STOP, BOOL_SWITCH_DIFF, BOOL_SWITCH_LIST };
3031

@@ -120,7 +121,11 @@ static private (Dictionary<string, string> StringSwitches, Dictionary<string, bo
120121
while (i < args.Length)
121122
{
122123
var arg = args[i];
123-
if (VALUE_SWITCHES.Contains(arg))
124+
if (VALUE_SWICTHES_IGNORED.Contains(arg))
125+
{
126+
i++;
127+
}
128+
else if (VALUE_SWITCHES.Contains(arg))
124129
{
125130
var value = args[++i];
126131
stringSwitches[arg] = value;

netmockery/Program.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.AspNetCore.Builder;
1+
using Microsoft.AspNetCore.Builder;
22
using Microsoft.AspNetCore.Http;
33
using Microsoft.Extensions.DependencyInjection;
44
using System;
@@ -20,16 +20,7 @@ public static void Main(string[] args)
2020

2121
public static async Task MainAsync(string[] args)
2222
{
23-
ParsedCommandLine parsedArguments;
24-
try
25-
{
26-
parsedArguments = CommandLineParser.ParseArguments(args);
27-
}
28-
catch (CommandLineParsingException clpe)
29-
{
30-
Console.Error.WriteLine($"ERROR: {clpe.Message}");
31-
return;
32-
}
23+
ParsedCommandLine parsedArguments = CommandLineParser.ParseArguments(args);
3324

3425
if (!Directory.Exists(parsedArguments.Endpoints))
3526
{

netmockery/netmockery.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net6.0</TargetFramework>
5-
<Version>0.13.0</Version>
6-
<AssemblyVersion>0.13.0.0</AssemblyVersion>
7-
<FileVersion>0.13.0.0</FileVersion>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Version>0.14.0</Version>
6+
<AssemblyVersion>0.14.0.0</AssemblyVersion>
7+
<FileVersion>0.14.0.0</FileVersion>
88
</PropertyGroup>
99
<ItemGroup>
1010
<Content Update="wwwroot\*" CopyToPublishDirectory="Always" CopyToOutputDirectory="Always" />

0 commit comments

Comments
 (0)