// TEST_END // TEST_START public void VoidMethod() { moq::Mock <VoidReturn.VoidReturnClient> mockGrpcClient = new moq::Mock <VoidReturn.VoidReturnClient>(moq::MockBehavior.Strict); Request request = new Request { ResourceName = ResourceName.FromItem("[ITEM_ID]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.VoidMethod(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); VoidReturnClient client = new VoidReturnClientImpl(mockGrpcClient.Object, null); client.VoidMethod(request.Name); mockGrpcClient.VerifyAll(); }
// TEST_END // TEST_START public async stt::Task VoidMethodAsync() { moq::Mock <VoidReturn.VoidReturnClient> mockGrpcClient = new moq::Mock <VoidReturn.VoidReturnClient>(moq::MockBehavior.Strict); Request request = new Request { ResourceName = ResourceName.FromItem("[ITEM_ID]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.VoidMethodAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); VoidReturnClient client = new VoidReturnClientImpl(mockGrpcClient.Object, null); await client.VoidMethodAsync(request.Name, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.VoidMethodAsync(request.Name, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }