测试 gRPC 购物车服务

This commit is contained in:
administrator committed 2024-07-11 20:57:59 +08:00
1 parent c192d209fd
commit 680ce10fa7
12 files changed
+494 -3

No files matched your search

@@ -0,0 +1,25 @@
// Copyright (c) HelloShop Corporation. All rights reserved.
// See the license file in the project root for more information.
using Grpc.Net.Client;
using HelloShop.BasketService.Protos;
namespace HelloShop.BasketService.FunctionalTests
{
public class GreeterServiceIntegrationTest
{
[Fact]
public async Task SayHelloReturnsHelloMessage()
{
// Arrange
using var channel = GrpcChannel.ForAddress(GrpcConstants.GrpcAddress);
var client = new Greeter.GreeterClient(channel);
// Act
var reply = await client.SayHelloAsync(new HelloRequest { Name = "Greeter" });
// Assert
Assert.Equal("Hello Greeter", reply.Message);
}
}
}