From f7b61f98a1b60deeebdc972e16bdd35bb38ae385 Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Tue, 23 Jan 2024 08:42:29 +0100 Subject: [PATCH 1/2] Add API for generating dotnet solution file template --- Sources/Directory.Packages.props | 3 +- .../SolutionFileStringBuilderTests.cs | 33 +++++++++++++++++ .../GlobalUsings.cs | 4 +++ .../Kysect.DotnetProjectSystem.Tests.csproj | 12 ++++++- .../Generating/SolutionFileStringBuilder.cs | 35 +++++++++++++++++++ .../Kysect.DotnetProjectSystem.csproj | 5 --- Sources/Kysect.DotnetProjectSystem/Program.cs | 2 -- 7 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 Sources/Kysect.DotnetProjectSystem.Tests/Generating/SolutionFileStringBuilderTests.cs create mode 100644 Sources/Kysect.DotnetProjectSystem.Tests/GlobalUsings.cs create mode 100644 Sources/Kysect.DotnetProjectSystem/Generating/SolutionFileStringBuilder.cs delete mode 100644 Sources/Kysect.DotnetProjectSystem/Program.cs diff --git a/Sources/Directory.Packages.props b/Sources/Directory.Packages.props index a6f8267..6da6fd4 100644 --- a/Sources/Directory.Packages.props +++ b/Sources/Directory.Packages.props @@ -9,7 +9,7 @@ - + @@ -36,5 +36,6 @@ + \ No newline at end of file diff --git a/Sources/Kysect.DotnetProjectSystem.Tests/Generating/SolutionFileStringBuilderTests.cs b/Sources/Kysect.DotnetProjectSystem.Tests/Generating/SolutionFileStringBuilderTests.cs new file mode 100644 index 0000000..bc4d03f --- /dev/null +++ b/Sources/Kysect.DotnetProjectSystem.Tests/Generating/SolutionFileStringBuilderTests.cs @@ -0,0 +1,33 @@ +using Kysect.DotnetProjectSystem.Generating; + +namespace Kysect.DotnetProjectSystem.Tests.Generating; + +public class SolutionFileStringBuilderTests +{ + private readonly SolutionFileStringBuilder _sut; + + public SolutionFileStringBuilderTests() + { + _sut = new SolutionFileStringBuilder(); + } + + [Fact] + public void Build_WithoutModification_ReturnTemplateString() + { + var expected = """ + Microsoft Visual Studio Solution File, Format Version 12.00 + # Visual Studio Version 17 + VisualStudioVersion = 17.9.34310.174 + MinimumVisualStudioVersion = 10.0.40219.1 + Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + EndGlobal + """; + + string actual = _sut.Build(); + + actual.Should().Be(expected); + } +} \ No newline at end of file diff --git a/Sources/Kysect.DotnetProjectSystem.Tests/GlobalUsings.cs b/Sources/Kysect.DotnetProjectSystem.Tests/GlobalUsings.cs new file mode 100644 index 0000000..fa742ab --- /dev/null +++ b/Sources/Kysect.DotnetProjectSystem.Tests/GlobalUsings.cs @@ -0,0 +1,4 @@ +// Global using directives + +global using FluentAssertions; +global using Xunit; \ No newline at end of file diff --git a/Sources/Kysect.DotnetProjectSystem.Tests/Kysect.DotnetProjectSystem.Tests.csproj b/Sources/Kysect.DotnetProjectSystem.Tests/Kysect.DotnetProjectSystem.Tests.csproj index e8b6ab3..105cc0a 100644 --- a/Sources/Kysect.DotnetProjectSystem.Tests/Kysect.DotnetProjectSystem.Tests.csproj +++ b/Sources/Kysect.DotnetProjectSystem.Tests/Kysect.DotnetProjectSystem.Tests.csproj @@ -5,9 +5,11 @@ false true + $(NoWarn);CA1707 +