-
-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix accessibility of MarshallingAsyncStreamReaderWriter
- Loading branch information
Showing
5 changed files
with
79 additions
and
15 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 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
56 changes: 56 additions & 0 deletions
56
tests/MagicOnion.Generator.Tests/GenerateRawStreamingTest.cs
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,56 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using Microsoft.CodeAnalysis; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace MagicOnion.Generator.Tests | ||
{ | ||
public class GenerateRawStreamingTest | ||
{ | ||
private readonly ITestOutputHelper _testOutputHelper; | ||
|
||
public GenerateRawStreamingTest(ITestOutputHelper testOutputHelper) | ||
{ | ||
_testOutputHelper = testOutputHelper; | ||
} | ||
|
||
[Fact] | ||
public async Task StreamingResult() | ||
{ | ||
using var tempWorkspace = TemporaryProjectWorkarea.Create(); | ||
tempWorkspace.AddFileToProject("IMyService.cs", @" | ||
using System; | ||
using MessagePack; | ||
using MagicOnion; | ||
using System.Threading.Tasks; | ||
namespace TempProject | ||
{ | ||
public interface IMyService : IService<IMyService> | ||
{ | ||
Task<ClientStreamingResult<string, string>> ClientStreamingAsync(); | ||
Task<ServerStreamingResult<string>> ServerStreamingAsync(); | ||
Task<DuplexStreamingResult<string, string>> DuplexStreamingAsync(); | ||
} | ||
} | ||
"); | ||
|
||
var compiler = new MagicOnionCompiler(_testOutputHelper.WriteLine, CancellationToken.None); | ||
await compiler.GenerateFileAsync( | ||
tempWorkspace.CsProjectPath, | ||
Path.Combine(tempWorkspace.OutputDirectory, "Generated.cs"), | ||
true, | ||
"TempProject.Generated", | ||
"", | ||
"MessagePack.Formatters" | ||
); | ||
|
||
var compilation = tempWorkspace.GetOutputCompilation().Compilation; | ||
compilation.GetDiagnostics().Where(x => x.Severity == DiagnosticSeverity.Error).Should().BeEmpty(); | ||
} | ||
} | ||
} |
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