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 .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2026.1.3",
"version": "2026.2.4.1",
"commands": [
"jb"
],
"rollForward": false
},
"regitlint": {
"version": "6.3.13",
"version": "6.3.14",
"commands": [
"regitlint"
],
Expand Down
5 changes: 5 additions & 0 deletions Steeltoe.NetCoreToolService.slnx.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EventNeverSubscribedTo_002ELocal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ExtractCommonPropertyPattern/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=IntroduceOptionalParameters_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InvertIf/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InvokeAsExtensionMemberFromSameClass/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LambdaExpressionMustBeStatic/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LocalFunctionCanBeMadeStatic/@EntryIndexedValue">SUGGESTION</s:String>
Expand Down Expand Up @@ -93,6 +94,8 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=TailRecursiveCall/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=TryCastAlwaysSucceeds/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnassignedGetOnlyAutoProperty/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnknownOutputParameter/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnknownTaskAttribute/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnnecessaryWhitespace/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseArrayEmptyMethod/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseCollectionCountProperty/@EntryIndexedValue">WARNING</s:String>
Expand All @@ -106,6 +109,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/SweaWarningsMode/@EntryValue">ShowAndRun</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/UseCollectionExpression/ConvertEmptyCollection/@EntryValue">SUGGESTION</s:String>
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/UseCollectionExpression/ConvertForInterfaceTargetTypes/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/UseCollectionExpression/SuggestCollectionExpressionWithSingleSpread/@EntryValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Steeltoe_0020Full_0020Cleanup/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Steeltoe Full Cleanup"&gt;&lt;XMLReformatCode&gt;True&lt;/XMLReformatCode&gt;&lt;CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" ArrangeNamespaces="True" ArrangeNullCheckingPattern="True" ArrangeAccessors="True" /&gt;&lt;CssAlphabetizeProperties&gt;True&lt;/CssAlphabetizeProperties&gt;&lt;JsInsertSemicolon&gt;True&lt;/JsInsertSemicolon&gt;&lt;FormatAttributeQuoteDescriptor&gt;True&lt;/FormatAttributeQuoteDescriptor&gt;&lt;CorrectVariableKindsDescriptor&gt;True&lt;/CorrectVariableKindsDescriptor&gt;&lt;VariablesToInnerScopesDescriptor&gt;True&lt;/VariablesToInnerScopesDescriptor&gt;&lt;StringToTemplatesDescriptor&gt;True&lt;/StringToTemplatesDescriptor&gt;&lt;JsReformatCode&gt;True&lt;/JsReformatCode&gt;&lt;JsFormatDocComments&gt;True&lt;/JsFormatDocComments&gt;&lt;RemoveRedundantQualifiersTs&gt;True&lt;/RemoveRedundantQualifiersTs&gt;&lt;OptimizeImportsTs&gt;True&lt;/OptimizeImportsTs&gt;&lt;OptimizeReferenceCommentsTs&gt;True&lt;/OptimizeReferenceCommentsTs&gt;&lt;PublicModifierStyleTs&gt;True&lt;/PublicModifierStyleTs&gt;&lt;ExplicitAnyTs&gt;True&lt;/ExplicitAnyTs&gt;&lt;TypeAnnotationStyleTs&gt;True&lt;/TypeAnnotationStyleTs&gt;&lt;RelativePathStyleTs&gt;True&lt;/RelativePathStyleTs&gt;&lt;AsInsteadOfCastTs&gt;True&lt;/AsInsteadOfCastTs&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;AspOptimizeRegisterDirectives&gt;True&lt;/AspOptimizeRegisterDirectives&gt;&lt;RemoveCodeRedundancies&gt;True&lt;/RemoveCodeRedundancies&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSMakeAutoPropertyGetOnly&gt;True&lt;/CSMakeAutoPropertyGetOnly&gt;&lt;CSArrangeQualifiers&gt;True&lt;/CSArrangeQualifiers&gt;&lt;CSFixBuiltinTypeReferences&gt;True&lt;/CSFixBuiltinTypeReferences&gt;&lt;CssReformatCode&gt;True&lt;/CssReformatCode&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;/CSOptimizeUsings&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;CSReorderTypeMembers&gt;True&lt;/CSReorderTypeMembers&gt;&lt;XAMLCollapseEmptyTags&gt;False&lt;/XAMLCollapseEmptyTags&gt;&lt;CSReformatInactiveBranches&gt;True&lt;/CSReformatInactiveBranches&gt;&lt;CSharpReformatComments&gt;True&lt;/CSharpReformatComments&gt;&lt;CSUpdateFileHeader&gt;True&lt;/CSUpdateFileHeader&gt;&lt;/Profile&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Steeltoe Full Cleanup</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOR/@EntryValue">Required</s:String>
Expand Down Expand Up @@ -622,6 +626,7 @@ See the LICENSE file in the project root for more information.&#xD;
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/TreeGridPresentableViewStyle/CompactMode/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=546845333F49494AB6CF8F0477A0F71D/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=546845333F49494AB6CF8F0477A0F71D/Comment/@EntryValue">Replace argument null check using throw expression with ArgumentNullException.ThrowIfNull</s:String>
<s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=546845333F49494AB6CF8F0477A0F71D/CustomPatternPlaceholder/=argument/@KeyIndexDefined">True</s:Boolean>
Expand Down
12 changes: 6 additions & 6 deletions Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

<PropertyGroup>
<AspNetVersion>10.0.*</AspNetVersion>
<CoverletCollectorVersion>10.0.*</CoverletCollectorVersion>
<CoverletCollectorVersion>10.1.*</CoverletCollectorVersion>
<FluentAssertionsVersion>7.2.*</FluentAssertionsVersion>
<MicrosoftAspNetCoreMvcTestingVersion>10.0.*</MicrosoftAspNetCoreMvcTestingVersion>
<MicrosoftNetTestSdkVersion>18.6.*</MicrosoftNetTestSdkVersion>
<MoqVersion>4.20.69</MoqVersion>
<ScalarVersion>2.16.*</ScalarVersion>
<SonarAnalyzerVersion>10.25.0.139117</SonarAnalyzerVersion>
<SteeltoeVersion>4.2.*</SteeltoeVersion>
<MicrosoftNetTestSdkVersion>18.11.*</MicrosoftNetTestSdkVersion>
<NSubstituteVersion>6.2.*</NSubstituteVersion>
<ScalarVersion>2.19.*</ScalarVersion>
<SonarAnalyzerVersion>10.33.0.1635</SonarAnalyzerVersion>
<SteeltoeVersion>4.3.*</SteeltoeVersion>
<StyleCopVersion>1.2.0-beta.556</StyleCopVersion>
<XunitVersion>3.2.*</XunitVersion>
<XunitVisualStudioVersion>3.1.*</XunitVisualStudioVersion>
Expand Down
46 changes: 23 additions & 23 deletions test/NetCoreToolService.Test/Controllers/NewControllerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging.Abstractions;
using Moq;
using NSubstitute;
using Steeltoe.NetCoreToolService.Controllers;
using Steeltoe.NetCoreToolService.Models;
using Steeltoe.NetCoreToolService.SteeltoeUtils.Diagnostics;
Expand All @@ -31,9 +31,9 @@ public sealed class NewControllerTest
public async Task GetTemplates_Should_Return_All_Templates()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
var executor = Substitute.For<ICommandExecutor>();

executor.Setup(c => c.ExecuteAsync($"{NewController.ExecutableName} new list", null, -1)).ReturnsAsync(new CommandResult
executor.ExecuteAsync($"{NewController.ExecutableName} new list", null, -1).Returns(new CommandResult
{
Output = """
These templates matched your input:
Expand All @@ -45,7 +45,7 @@ API Controller apicontroller [C#] Web/ASP.NET
"""
});

var controller = new NewController(executor.Object, EmptyConfiguration, NullLogger<NewController>.Instance);
var controller = new NewController(executor, EmptyConfiguration, NullLogger<NewController>.Instance);

// Act
ActionResult result = await controller.GetTemplates();
Expand Down Expand Up @@ -81,9 +81,9 @@ public async Task InstallTemplates_Is_Disabled_By_Default()
public async Task InstallTemplates_Should_Return_Installed_Templates()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
var executor = Substitute.For<ICommandExecutor>();

executor.SetupSequence(c => c.ExecuteAsync($"{NewController.ExecutableName} new list", null, -1)).ReturnsAsync(new CommandResult
executor.ExecuteAsync($"{NewController.ExecutableName} new list", null, -1).Returns(new CommandResult
{
Output = """
These templates matched your input:
Expand All @@ -93,7 +93,7 @@ Template Name Short Name Language Tags
My Template myt lang tags
My Other Template my-ot other-lang other-tags
"""
}).ReturnsAsync(new CommandResult
}, new CommandResult
{
Output = """
These templates matched your input:
Expand All @@ -107,9 +107,9 @@ Other New Template ont big-talk other-stuff
"""
});

executor.Setup(c => c.ExecuteAsync($"{NewController.ExecutableName} new install My.Templates", null, -1)).ReturnsAsync(default(CommandResult));
executor.ExecuteAsync($"{NewController.ExecutableName} new install My.Templates", null, -1).Returns(default(CommandResult));

var controller = new NewController(executor.Object, SensitiveEndpointsEnabledConfiguration, NullLogger<NewController>.Instance);
var controller = new NewController(executor, SensitiveEndpointsEnabledConfiguration, NullLogger<NewController>.Instance);

// Act
ActionResult result = await controller.InstallTemplates("My.Templates");
Expand Down Expand Up @@ -160,9 +160,9 @@ public async Task UninstallTemplates_Is_Disabled_By_Default()
public async Task UninstallTemplates_Should_Return_Uninstalled_Templates()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
var executor = Substitute.For<ICommandExecutor>();

executor.SetupSequence(c => c.ExecuteAsync($"{NewController.ExecutableName} new list", null, -1)).ReturnsAsync(new CommandResult
executor.ExecuteAsync($"{NewController.ExecutableName} new list", null, -1).Returns(new CommandResult
{
Output = """
These templates matched your input:
Expand All @@ -174,7 +174,7 @@ My Template myt lang tags
My Other Template my-ot other-lang other-tags
Other New Template ont big-talk other-stuff
"""
}).ReturnsAsync(new CommandResult
}, new CommandResult
{
Output = """
These templates matched your input:
Expand All @@ -186,9 +186,9 @@ My Other Template my-ot other-lang other-tags
"""
});

executor.Setup(c => c.ExecuteAsync($"{NewController.ExecutableName} new uninstall My.Templates", null, -1)).ReturnsAsync(default(CommandResult));
executor.ExecuteAsync($"{NewController.ExecutableName} new uninstall My.Templates", null, -1).Returns(default(CommandResult));

var controller = new NewController(executor.Object, SensitiveEndpointsEnabledConfiguration, NullLogger<NewController>.Instance);
var controller = new NewController(executor, SensitiveEndpointsEnabledConfiguration, NullLogger<NewController>.Instance);

// Act
ActionResult result = await controller.UninstallTemplates("My.Templates");
Expand Down Expand Up @@ -261,14 +261,14 @@ net6.0 Target net6.0
dotnet new classlib -h --language F#
""";

var executor = new Mock<ICommandExecutor>();
var executor = Substitute.For<ICommandExecutor>();

executor.Setup(c => c.ExecuteAsync($"{NewController.ExecutableName} new classlib --help", null, -1)).ReturnsAsync(new CommandResult
executor.ExecuteAsync($"{NewController.ExecutableName} new classlib --help", null, -1).Returns(new CommandResult
{
Output = helpText
});

var controller = new NewController(executor.Object, EmptyConfiguration, NullLogger<NewController>.Instance);
var controller = new NewController(executor, EmptyConfiguration, NullLogger<NewController>.Instance);

// Act
ActionResult result = await controller.GetTemplateHelp("classlib");
Expand Down Expand Up @@ -468,15 +468,15 @@ public async Task GetTemplateProject_UnknownPackagingFormat_Should_Return_BadReq
public async Task GetTemplateProject_UnknownError_Should_Return_InternalServerError()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
var executor = Substitute.For<ICommandExecutor>();

executor.Setup(c => c.ExecuteAsync(It.IsAny<string>(), It.IsAny<string>(), -1)).ReturnsAsync(new CommandResult
executor.ExecuteAsync(Arg.Any<string>(), Arg.Any<string?>(), Arg.Is(-1)).Returns(new CommandResult
{
ExitCode = 1,
Error = "Something bad happened."
});

var controller = new NewController(executor.Object, EmptyConfiguration, NullLogger<NewController>.Instance);
var controller = new NewController(executor, EmptyConfiguration, NullLogger<NewController>.Instance);

// Act
ActionResult result = await controller.GetTemplateProject("my-template");
Expand All @@ -491,15 +491,15 @@ public async Task GetTemplateProject_UnknownError_Should_Return_InternalServerEr
public async Task GetTemplateProject_UnknownOutput_Should_Return_InternalServerError()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
var executor = Substitute.For<ICommandExecutor>();

executor.Setup(c => c.ExecuteAsync(It.IsAny<string>(), It.IsAny<string>(), -1)).ReturnsAsync(new CommandResult
executor.ExecuteAsync(Arg.Any<string>(), Arg.Any<string?>(), Arg.Is(-1)).Returns(new CommandResult
{
Output = "Unexpected output.",
Error = string.Empty
});

var controller = new NewController(executor.Object, EmptyConfiguration, NullLogger<NewController>.Instance);
var controller = new NewController(executor, EmptyConfiguration, NullLogger<NewController>.Instance);

// Act
ActionResult result = await controller.GetTemplateProject("my-template");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(MicrosoftAspNetCoreMvcTestingVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
<PackageReference Include="xunit.v3" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVisualStudioVersion)" PrivateAssets="All" />
</ItemGroup>
Expand Down
Loading