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
2 changes: 0 additions & 2 deletions Steeltoe.NetCoreToolTemplates.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
azure-pipelines.yaml = azure-pipelines.yaml
DEVELOPER.md = DEVELOPER.md
src\Content\NetCoreTool.Template.WebApi\CSharp\Directory.Build.props = src\Content\NetCoreTool.Template.WebApi\CSharp\Directory.Build.props
test\Directory.Build.props = test\Directory.Build.props
README.md = README.md
version.json = version.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Steeltoe.NetCoreTool.Templates", "src\Steeltoe.NetCoreTool.Templates.csproj", "{8C63F895-1AD7-47F1-8074-7E6832E59D62}"
Expand Down
6 changes: 6 additions & 0 deletions Steeltoe.NetCoreToolTemplates.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=HashiCorp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PostgreSQL/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Steeltoe/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
"text": "Use dynamic Serilog logger"
},
"description": {
"text": "Enables dynamically changing minimum levels at runtime using Serlog."
"text": "Enables dynamically changing minimum levels at runtime using Serilog."
},
"isVisible": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@
"LoggingDynamicSerilogOption": {
"type": "parameter",
"datatype": "bool",
"description": "Enable dynamically changing minimum levels at runtime using Serlog.",
"description": "Enable dynamically changing minimum levels at runtime using Serilog.",
"defaultValue": "false"
},
"HasLoggingDynamicSerilogInSteeltoeV3": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Company.WebApplication.CS.csproj" />
</Solution>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected override async Task AssertProjectGeneration(ProjectOptions options)

if (options.SteeltoeVersion == SteeltoeVersion.Steeltoe32)
{
Logger.WriteLine($"asserting HelloHystrixCommand");
Logger.WriteLine("asserting HelloHystrixCommand");
var sourceFile = GetSourceFileForLanguage("HelloHystrixCommand", options.Language);
var source = await Sandbox.GetFileTextAsync(sourceFile);
source.Should().ContainSnippet("class HelloHystrixCommand");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using FluentAssertions;
using Steeltoe.NetCoreTool.Template.WebApi.Test.Models;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using FluentAssertions;
using Steeltoe.NetCoreTool.Template.WebApi.Test.Assertions;
using Steeltoe.NetCoreTool.Template.WebApi.Test.Models;
using Xunit;
using Xunit.Abstractions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using Steeltoe.NetCoreTool.Template.WebApi.Test.Models;
using Xunit.Abstractions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using FluentAssertions;
using Steeltoe.NetCoreTool.Template.WebApi.Test.Models;
Expand Down
14 changes: 14 additions & 0 deletions test/NetCoreTool.Template.WebApi.Test/DefaultsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,32 @@
using System.Threading.Tasks;
using FluentAssertions;
using Steeltoe.NetCoreTool.Template.WebApi.Test.Models;
using Xunit;
using Xunit.Abstractions;

namespace Steeltoe.NetCoreTool.Template.WebApi.Test
{
public class DefaultsTest(ITestOutputHelper logger)
: ProjectOptionTest(null, "Steeltoe ASP.NET Core Web API (C#)", logger)
{
[Fact]
[Trait("Category", "ProjectGeneration")]
public async Task TestDefaultNotPolluted()
{
using var sandbox = await TemplateSandbox("false");
sandbox.FileExists("Directory.Build.props").Should().BeFalse();
}

protected override async Task AssertProjectGeneration(ProjectOptions options)
{
await base.AssertProjectGeneration(options);

Sandbox.FileExists(".gitignore").Should().BeTrue();
Sandbox.FileExists("app.config").Should().BeTrue();
Sandbox.FileExists($"{Sandbox.Name}.slnx").Should().BeTrue();
Sandbox.FileExists($"{Sandbox.Name}.csproj").Should().BeTrue();
Sandbox.FileExists($"{Sandbox.Name}.http").Should().BeTrue();
Sandbox.FileExists("Program.cs").Should().BeTrue();

if (options.IsUnstableVersion)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Steeltoe.NetCoreTool.Template.WebApi.Test;

public class LoggingDynamicSerilogOptionTest(ITestOutputHelper logger)
: ProjectOptionTest("logging-dynamic-serilog", "Enable dynamically changing minimum levels at runtime using Serlog.", logger)
: ProjectOptionTest("logging-dynamic-serilog", "Enable dynamically changing minimum levels at runtime using Serilog.", logger)
{
protected override void AssertPackageReferencesHook(ProjectOptions options, List<(string, string)> packages)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using FluentAssertions;
using Steeltoe.NetCoreTool.Template.WebApi.Test.Models;
using Xunit.Abstractions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using FluentAssertions;
using Steeltoe.NetCoreTool.Template.WebApi.Test.Models;
Expand Down
4 changes: 2 additions & 2 deletions test/NetCoreTool.Template.WebApi.Test/TemplateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected TemplateTest(string option, string description, ITestOutputHelper logg
[Trait("Category", "Smoke")]
public async Task Smoke_Test()
{
Logger.WriteLine($"smoke testing help");
Logger.WriteLine("smoke testing help");
using var helpBox = await TemplateSandbox("--help");

if (Option != null)
Expand All @@ -42,7 +42,7 @@ public async Task Smoke_Test()
helpBox.CommandOutput.Should().Contain(Description);
}

Logger.WriteLine($"smoke testing option");
Logger.WriteLine("smoke testing option");
using var smokeBox = await TemplateSandbox($"{GetSmokeTestArgs()}");
}

Expand Down
2 changes: 1 addition & 1 deletion test/NetCoreTool.Template.WebApi.Test/Utilities/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class Command
var output = $"{outputBuilder}${errorBuilder}";
// if (process.ExitCode != 0)
// {
// throw new Exception($"'{command}' exited with exit code {process.ExitCode}:\n\n{output}");
// throw new Exception($"'{command}' exited with exit code {process.ExitCode}:\n\n{output}");
// }

return (process.ExitCode, output);
Expand Down
9 changes: 3 additions & 6 deletions test/NetCoreTool.Template.WebApi.Test/Utilities/Sandbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Steeltoe.NetCoreTool.Template.WebApi.Test.Utilities
{
public class Sandbox : TempDirectory
{
private static JsonSerializerOptions Options { get; } = new JsonSerializerOptions
private static JsonSerializerOptions Options { get; } = new()
{
PropertyNameCaseInsensitive = true,
ReadCommentHandling = JsonCommentHandling.Skip,
Expand All @@ -21,13 +21,10 @@ public class Sandbox : TempDirectory

public string CommandOutput { get; private set; }

public string Name
{
get => System.IO.Path.GetFileName(Path);
}
public string Name => System.IO.Path.GetFileName(Path);

public Sandbox(ITestOutputHelper logger) : base(
$"DotNetNewTemplatesSandboxes{System.IO.Path.DirectorySeparatorChar}P_{Guid.NewGuid().ToString().Replace("-", "_")}")
$"DotNetNewTemplatesSandboxes{System.IO.Path.DirectorySeparatorChar}P_{Guid.NewGuid():N}")
{
_logger = logger;
_logger.WriteLine($"sandbox: {Name}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,31 @@ public void Install()
Installer.EnsureInstalled(logger);
}

private class Installer
private static class Installer
{
static Installer()
{
var p = Process.Start(
var process = Process.Start(
new ProcessStartInfo
{
FileName = "dotnet",
Arguments = $"new uninstall {Directory.GetCurrentDirectory()}/../../../../../src/Content",
}
);
Assert.NotNull(p);
p.WaitForExit();
p = Process.Start(
Assert.NotNull(process);

process.WaitForExit();
process = Process.Start(
new ProcessStartInfo
{
FileName = "dotnet",
Arguments = $"new install {Directory.GetCurrentDirectory()}/../../../../../src/Content",
}
);
p.Should().NotBeNull();
p.WaitForExit();
p.ExitCode.Should().Be(0);
Assert.NotNull(process);

process.WaitForExit();
process.ExitCode.Should().Be(0);
}

internal static void EnsureInstalled(ITestOutputHelper logger)
Expand Down
Loading