Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SwedishTestSsn.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
# Visual Studio Version 18
VisualStudioVersion = 18.0.11018.127 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwedishTestSsn.Core", "src\SwedishTestSsn.Core\SwedishTestSsn.Core.csproj", "{36271D9E-465A-4CD3-BF0B-A6E866D8C5E1}"
EndProject
Expand Down
10 changes: 5 additions & 5 deletions src/SwedishTestSsn.Core.Test/SwedishTestSsn.Core.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Microsoft.Testing.Platform" Version="1.9.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.10" />
<PackageReference Include="Microsoft.Testing.Platform" Version="2.0.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit.v3" Version="3.1.0" />
<!--<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1" />-->
<PackageReference Include="xunit.v3" Version="3.1.1-pre.9" />
</ItemGroup>

<PropertyGroup>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\SwedishTestSsn.Core\SwedishTestSsn.Core.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SwedishTestSsn.Core/SwedishTestSsn.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.10" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/SwedishTestSsn/SwedishTestSsn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Spectre.Console" Version="0.52.0" />
<PackageReference Include="Spectre.Console.Cli" Version="0.52.0" />
<PackageReference Include="Spectre.Console.Json" Version="0.52.0" />
<PackageReference Include="Spectre.Console" Version="0.53.0" />
<PackageReference Include="Spectre.Console.Cli" Version="0.53.0" />
<PackageReference Include="Spectre.Console.Json" Version="0.53.0" />
</ItemGroup>

<ItemGroup>
Expand Down
48 changes: 24 additions & 24 deletions src/SwedishTestSsn/TestSsnCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,7 @@ public TestSsnCommand() : base()
_ssnClient = new Client(_client);
}

public override async Task<int> ExecuteAsync(
[NotNull] CommandContext context,
[NotNull] Settings settings)
{
var result = await GetData(settings);

if (result.Length == 0)
{
AnsiConsole.MarkupLine($"[red]No result for pattern: {settings.Pattern}[/]");
return 1;
}

if (settings.Json)
{
PrintJson(result);
}
else
{
PrintText(result);
}

return 0;
}


private static void PrintText(ImmutableArray<string> result)
{
Expand Down Expand Up @@ -106,5 +84,27 @@ private async Task<ImmutableArray<string>> GetData(Settings settings)
AnsiConsole.MarkupLine($"[red]Error with skatteverket api[/]");
return [];
}
}
}

public override async Task<int> ExecuteAsync(CommandContext context, Settings settings, CancellationToken cancellationToken)
{
var result = await GetData(settings);

if (result.Length == 0)
{
AnsiConsole.MarkupLine($"[red]No result for pattern: {settings.Pattern}[/]");
return 1;
}

if (settings.Json)
{
PrintJson(result);
}
else
{
PrintText(result);
}

return 0;
}
}