Sample project with GRPC services server side and test clients. Both were implemented on NET8
- Both clients and server use copy of the same ".proto" file/contracts.
- These files define an interface
- In real world, In real world, .proto file can be a part of the shared NuGet package. Out solutio contain both Server and Client for simplification
Just a sample console application that was added to test default Greeter service.
GRPC server implementation. YOu should run it first.
- In Visual Studio --> Configure Startup project--> Make sure server project is selected
- Click "Start" arrow button
- Open CMD for the Server project
- Run build command "dotnet build"
- Run start command "dotnet run"
- Using Powershell script
- Open Powerhshell for Server project
- Run "Start.ps1" powershell script
NUnit test project was build as POC. The idea was to use GRPC proto contract and implement client and tests
- Make sure latest version of ".proto" contract file was specified in protos folder.
- Make sure Client proto configuration is equal to: Build Action = Protobug compiler, gRPC Stub Classes = Client only
- Make sure server is running. See "How to run" section for server project
- Select .runsettings file you want to run with, on top navigation menu -> "Test" -> "Configure Run Settings" --> Select file from the project root
- Open Test Explorer window, on top navigation menu -> "Test" -> "Test Explorer"
- Choice test you want to run or all tests scope
- Right button context menu and click run
- Open CMD in the root of the test project
- Type "dotnet test -s "./localhost_5000.runsettings"", where -s is a location of .runsettings test configuration file