Enhanced.Testing.Component.GrpcClient 1.6.0

dotnet add package Enhanced.Testing.Component.GrpcClient --version 1.6.0
                    
NuGet\Install-Package Enhanced.Testing.Component.GrpcClient -Version 1.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Enhanced.Testing.Component.GrpcClient" Version="1.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Enhanced.Testing.Component.GrpcClient" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Enhanced.Testing.Component.GrpcClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Enhanced.Testing.Component.GrpcClient --version 1.6.0
                    
#r "nuget: Enhanced.Testing.Component.GrpcClient, 1.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Enhanced.Testing.Component.GrpcClient@1.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Enhanced.Testing.Component.GrpcClient&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Enhanced.Testing.Component.GrpcClient&version=1.6.0
                    
Install as a Cake Tool

Enhanced.Testing.Component.GrpcClient

NuGet

A gRPC client harness for Enhanced.Testing.Component: creates generated gRPC clients that call the application in memory through TestServer, without opening network ports.

dotnet add package Enhanced.Testing.Component.GrpcClient

Usage

var grpc = new GrpcClientHarness();

var component = ComponentBuilder.Create<Program>()
                                .AddHarness(grpc)
                                .Build();

In a test, create any client generated from your .proto files:

var client = grpc.CreateClient<Greeter.GreeterClient>();

var reply = await client.SayHelloAsync(new HelloRequest { Name = "John" });

Assert.Equal("Hello John", reply.Message);

The harness creates one channel per client type and shuts the channels down when the component stops.

The test project usually references the service project, so generate the client there, next to the server code, and use it from the tests:

<ItemGroup>
  <Protobuf Include="Protos\greet.proto" GrpcServices="Both" />
</ItemGroup>

Don't generate the same .proto file again in the test project: the generated types would exist twice and the build reports CS0436 conflicts. If the test project doesn't reference the service project, generate the client there instead (GrpcServices="Client", with the Grpc.Tools and Google.Protobuf packages, or Grpc.AspNetCore, which includes both).

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.6.0 80 11/22/2026
1.5.0 78 11/20/2026
1.4.0 165 11/13/2026
1.3.0 143 11/12/2026
1.2.4 2,075 3/4/2026
1.2.3 456 10/18/2024
1.2.2 253 8/7/2024
1.2.1 212 8/4/2024
1.2.0 229 8/1/2024
1.1.1 234 7/22/2024
1.1.0 245 7/21/2024
1.0.1 245 7/16/2024
1.0.0 263 6/12/2024