-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GRPC really bloated the nuget package, this accomplishes the same thi…
…ng. (#1137) * GRPC really bloated the nuget package, this accomplishes the same thing. * code review changes * formatting files * delete this
- Loading branch information
Showing
9 changed files
with
128 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
namespace CSharpier.Cli.Tests; | ||
|
||
using System.Diagnostics; | ||
using System.Net.Http.Json; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class IpcTests | ||
{ | ||
private static readonly HttpClient httpClient = new HttpClient(); | ||
|
||
// TODO server add other tests | ||
// starting on port | ||
// ignore file | ||
// option file | ||
[Test] | ||
[Ignore("not working on GH/linux")] | ||
public async Task Stuff() | ||
{ | ||
var path = Path.Combine(Directory.GetCurrentDirectory(), "dotnet-csharpier.dll"); | ||
|
||
var processStartInfo = new ProcessStartInfo("dotnet", $"{path} --ipc") | ||
{ | ||
UseShellExecute = false, | ||
ErrorDialog = false, | ||
CreateNoWindow = true, | ||
WindowStyle = ProcessWindowStyle.Hidden, | ||
RedirectStandardOutput = true, | ||
RedirectStandardError = true, | ||
EnvironmentVariables = { ["DOTNET_NOLOGO"] = "1" }, | ||
}; | ||
|
||
var process = new Process { StartInfo = processStartInfo }; | ||
try | ||
{ | ||
process.Start(); | ||
|
||
var portString = (await process.StandardOutput.ReadLineAsync() ?? string.Empty).Replace( | ||
"Started on ", | ||
string.Empty | ||
); | ||
var port = int.Parse(portString); | ||
var data = new FormatFileDto | ||
{ | ||
FileName = "/Temp/test.cs", | ||
FileContents = "public class TestClass { }" | ||
}; | ||
|
||
var response = await httpClient.PostAsJsonAsync( | ||
$"http://localhost:{port}/format", | ||
data | ||
); | ||
response.EnsureSuccessStatusCode(); | ||
var result = await response.Content.ReadFromJsonAsync<FormatFileResult>(); | ||
if (result == null) | ||
{ | ||
Assert.Fail("Result is null"); | ||
} | ||
|
||
result!.FormattedFile!.TrimEnd().Should().Be("public class TestClass { }"); | ||
} | ||
finally | ||
{ | ||
process.Kill(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.