diff --git a/AspNetCoreExample.Api/AspNetCoreExample.Api.csproj b/AspNetCoreExample.Api/AspNetCoreExample.Api.csproj
index eb80598..11d023f 100644
--- a/AspNetCoreExample.Api/AspNetCoreExample.Api.csproj
+++ b/AspNetCoreExample.Api/AspNetCoreExample.Api.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
enable
enable
latest
@@ -13,8 +13,8 @@
-
-
+
+
\ No newline at end of file
diff --git a/AspNetCoreExample.Generator/AspNetCoreExample.Generator.csproj b/AspNetCoreExample.Generator/AspNetCoreExample.Generator.csproj
index 7eb21e9..a7f5438 100644
--- a/AspNetCoreExample.Generator/AspNetCoreExample.Generator.csproj
+++ b/AspNetCoreExample.Generator/AspNetCoreExample.Generator.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
Exe
enable
enable
diff --git a/Directory.Build.props b/Directory.Build.props
index 5b9556d..ee3d356 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -19,8 +19,8 @@
-
-
+
+
\ No newline at end of file
diff --git a/TypeScript.ContractGenerator.Cli/TypeScript.ContractGenerator.Cli.csproj b/TypeScript.ContractGenerator.Cli/TypeScript.ContractGenerator.Cli.csproj
index a9b37f5..a5fd3b6 100644
--- a/TypeScript.ContractGenerator.Cli/TypeScript.ContractGenerator.Cli.csproj
+++ b/TypeScript.ContractGenerator.Cli/TypeScript.ContractGenerator.Cli.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
SkbKontur.TypeScript.ContractGenerator.Cli
SkbKontur.TypeScript.ContractGenerator.Cli
SkbKontur.TypeScript.ContractGenerator.Cli
diff --git a/TypeScript.ContractGenerator.Roslyn/TypeScript.ContractGenerator.Roslyn.csproj b/TypeScript.ContractGenerator.Roslyn/TypeScript.ContractGenerator.Roslyn.csproj
index 2921d61..abcd404 100644
--- a/TypeScript.ContractGenerator.Roslyn/TypeScript.ContractGenerator.Roslyn.csproj
+++ b/TypeScript.ContractGenerator.Roslyn/TypeScript.ContractGenerator.Roslyn.csproj
@@ -12,7 +12,7 @@
-
+
\ No newline at end of file
diff --git a/TypeScript.ContractGenerator.Tests/CliTest.cs b/TypeScript.ContractGenerator.Tests/CliTest.cs
index afa0aef..f171c63 100644
--- a/TypeScript.ContractGenerator.Tests/CliTest.cs
+++ b/TypeScript.ContractGenerator.Tests/CliTest.cs
@@ -13,11 +13,11 @@ public class CliTest
[Test]
public void CliGenerated()
{
- RunCmdCommand($"dotnet {pathToSlnDirectory}/TypeScript.ContractGenerator.Cli/bin/{configuration}/net7.0/SkbKontur.TypeScript.ContractGenerator.Cli.dll " +
- $"-a {pathToSlnDirectory}/AspNetCoreExample.Api/bin/{configuration}/net7.0/AspNetCoreExample.Api.dll " +
- $"-o {TestContext.CurrentContext.TestDirectory}/cliOutput " +
- "--nullabilityMode NullableReference " +
- "--lintMode TsLint");
+ RunDotnetCommand($"{pathToSlnDirectory}/TypeScript.ContractGenerator.Cli/bin/{configuration}/{targetFramework}/SkbKontur.TypeScript.ContractGenerator.Cli.dll " +
+ $"-a {pathToSlnDirectory}/AspNetCoreExample.Api/bin/{configuration}/{targetFramework}/AspNetCoreExample.Api.dll " +
+ $"-o {TestContext.CurrentContext.TestDirectory}/cliOutput " +
+ "--nullabilityMode NullableReference " +
+ "--lintMode TsLint");
var expectedDirectory = $"{pathToSlnDirectory}/AspNetCoreExample.Generator/output";
var actualDirectory = $"{TestContext.CurrentContext.TestDirectory}/cliOutput";
@@ -27,40 +27,47 @@ public void CliGenerated()
[Test]
public void RoslynCliGenerated()
{
- RunCmdCommand($"dotnet {pathToSlnDirectory}/TypeScript.ContractGenerator.Cli/bin/{configuration}/net7.0/SkbKontur.TypeScript.ContractGenerator.Cli.dll " +
- $"-d {pathToSlnDirectory}/AspNetCoreExample.Api " +
- $"-a {typeof(ControllerBase).Assembly.Location} " +
- $"-o {TestContext.CurrentContext.TestDirectory}/roslynCliOutput " +
- "--nullabilityMode NullableReference " +
- "--lintMode TsLint");
+ RunDotnetCommand($"{pathToSlnDirectory}/TypeScript.ContractGenerator.Cli/bin/{configuration}/{targetFramework}/SkbKontur.TypeScript.ContractGenerator.Cli.dll " +
+ $"-d {pathToSlnDirectory}/AspNetCoreExample.Api " +
+ $"-a {typeof(ControllerBase).Assembly.Location} " +
+ $"-o {TestContext.CurrentContext.TestDirectory}/roslynCliOutput " +
+ "--nullabilityMode NullableReference " +
+ "--lintMode TsLint");
var expectedDirectory = $"{pathToSlnDirectory}/AspNetCoreExample.Generator/output";
var actualDirectory = $"{TestContext.CurrentContext.TestDirectory}/roslynCliOutput";
TestBase.CheckDirectoriesEquivalenceInner(expectedDirectory, actualDirectory, generatedOnly : true);
}
- private static void RunCmdCommand(string command)
+ private static void RunDotnetCommand(string command)
{
var process = new Process
{
- StartInfo =
+ StartInfo = new ProcessStartInfo("dotnet", command)
{
- FileName = "cmd.exe",
WindowStyle = ProcessWindowStyle.Hidden,
- Arguments = "/C " + command,
- }
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ UseShellExecute = false
+ },
};
+
process.Start();
process.WaitForExit();
+
process.ExitCode.Should().Be(0);
+ process.StandardOutput.ReadToEnd().Trim().Should().Be("Generating TypeScript");
+ process.StandardError.ReadToEnd().Trim().Should().BeEmpty();
}
private static readonly string pathToSlnDirectory = $"{TestContext.CurrentContext.TestDirectory}/../../../../";
+ private const string targetFramework = "net8.0";
+
#if RELEASE
- const string configuration = "Release";
+ private const string configuration = "Release";
#elif DEBUG
- const string configuration = "Debug";
+ private const string configuration = "Debug";
#endif
}
}
\ No newline at end of file
diff --git a/TypeScript.ContractGenerator.Tests/CustomTypeGenerators/SimpleStructureTypeLocator.cs b/TypeScript.ContractGenerator.Tests/CustomTypeGenerators/SimpleStructureTypeLocator.cs
index 5fd0cbd..e26b3dd 100644
--- a/TypeScript.ContractGenerator.Tests/CustomTypeGenerators/SimpleStructureTypeLocator.cs
+++ b/TypeScript.ContractGenerator.Tests/CustomTypeGenerators/SimpleStructureTypeLocator.cs
@@ -1,3 +1,5 @@
+using System.IO;
+
using SkbKontur.TypeScript.ContractGenerator.Abstractions;
using SkbKontur.TypeScript.ContractGenerator.CodeDom;
using SkbKontur.TypeScript.ContractGenerator.TypeBuilders;
@@ -8,7 +10,7 @@ public class SimpleStructureTypeLocator : ICustomTypeGenerator
{
public string GetTypeLocation(ITypeInfo type)
{
- return $"{type.Name}\\{type.Name}";
+ return $"{type.Name}{Path.DirectorySeparatorChar}{type.Name}";
}
public ITypeBuildingContext? ResolveType(string initialUnitPath, ITypeGenerator typeGenerator, ITypeInfo type, ITypeScriptUnitFactory unitFactory)
diff --git a/TypeScript.ContractGenerator.Tests/TypeScript.ContractGenerator.Tests.csproj b/TypeScript.ContractGenerator.Tests/TypeScript.ContractGenerator.Tests.csproj
index 19b8b01..27d1f45 100644
--- a/TypeScript.ContractGenerator.Tests/TypeScript.ContractGenerator.Tests.csproj
+++ b/TypeScript.ContractGenerator.Tests/TypeScript.ContractGenerator.Tests.csproj
@@ -1,7 +1,7 @@
- net48;net6.0;net7.0
+ net48;net6.0;net8.0
SkbKontur.TypeScript.ContractGenerator.Tests
SkbKontur.TypeScript.ContractGenerator.Tests
@@ -11,12 +11,12 @@
-
-
+
+
-
-
-
+
+
+
diff --git a/global.json b/global.json
index ece2da4..9e0754e 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "7.0.0",
+ "version": "8.0.0",
"rollForward": "latestFeature"
}
}
\ No newline at end of file