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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added cancellation token support for commands
- Added a built-in `verify-dependencies` command that validates the application's Dependency Injection setup by ensuring all required services are fully and correctly registered in the composition root.
- Added a built-in `check-deps` command that validates the application's Dependency Injection setup by ensuring all required services are fully and correctly registered in the composition root.

### Changed

- Updated Scrutor to v6.0.1
- Updated NLog.Extensions.Logging to v5.3.15
- Updated Microsoft.Extensions.Configuration.Json to v8.0.1
- Updated Microsoft.Extensions.Configuration.UserSecrets to v8.0.1
- Updated Microsoft.Extensions.DependencyInjection to v8.0.1
- Updated Microsoft.Extensions.Hosting to v8.0.1
- Updated Microsoft.Extensions.Logging to v8.0.1
- Updated Microsoft.Extensions.Logging.Configuration to v8.0.1

## [3.0.4] - 2024-11-28

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="Neolution.CodeAnalysis" Version="3.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"DOTNET_ENVIRONMENT": "Development"
}
},
"Sample Console App: verify-dependencies": {
"Sample Console App: check-deps": {
"commandName": "Project",
"commandLineArgs": "verify-dependencies",
"commandLineArgs": "check-deps",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
Expand Down
377 changes: 377 additions & 0 deletions Neolution.DotNet.Console.SampleAsync/packages.lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Neolution.DotNet.Console.UnitTests/DotNetConsoleBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
public class DotNetConsoleBuilderTests
{
/// <summary>
/// The argument string for the internal verify-dependencies command
/// The argument string for the internal check-deps command
/// </summary>
private static readonly string[] VerifyDependenciesArgs = { "verify-dependencies" };
private const string CheckDependenciesArgumentString = "check-deps";

/// <summary>
/// Given a mistyped verb, when a default verb is defined, then should throw on console building.
Expand Down Expand Up @@ -97,13 +97,13 @@ public void GivenInvalidArguments_WhenNoDefaultVerbIsDefined_ThenShouldNotThrowO
}

/// <summary>
/// Given the verify-dependencies builder, when registration is missing, then should throw on console building.
/// Given the check-deps builder, when registration is missing, then should throw on console building.
/// </summary>
[Fact]
public void GivenVerifyDependenciesCommand_WhenRegistrationIsMissing_ThenShouldThrow()
public void GivenCheckDependenciesCommand_WhenRegistrationIsMissing_ThenShouldThrow()
{
// Arrange
var builder = DotNetConsole.CreateBuilderWithReference(Assembly.GetAssembly(typeof(DefaultCommand))!, VerifyDependenciesArgs);
var builder = DotNetConsole.CreateBuilderWithReference(Assembly.GetAssembly(typeof(DefaultCommand))!, [CheckDependenciesArgumentString]);

// Intentionally only registering the transient service and not the scoped and singleton services.
builder.Services.AddTransient<ITransientServiceStub, TransientServiceStub>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void GivenServicesWithVariousServiceLifetimes_WhenRunningConsoleApp_ThenS
[InlineData("--version")]
[InlineData("help echo")]
[InlineData("echo --help")]
[InlineData("verify-dependencies")]
[InlineData("check-deps")]
public void GivenValidArguments_WhenNoDefaultVerbIsDefined_ThenShouldNotThrow([NotNull] string args)
{
ArgumentNullException.ThrowIfNull(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>

<AssemblyName>Neolution.DotNet.Console.UnitTests</AssemblyName>

<RootNamespace>Neolution.DotNet.Console.UnitTests</RootNamespace>

<LangVersion>default</LangVersion>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.3">
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -23,13 +20,13 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Objectivity.AutoFixture.XUnit2.AutoNSubstitute" Version="3.6.2" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.3">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading