public async stt::Task FetchDeploymentStateRequestObjectAsync() { moq::Mock <GameServerDeploymentsService.GameServerDeploymentsServiceClient> mockGrpcClient = new moq::Mock <GameServerDeploymentsService.GameServerDeploymentsServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); FetchDeploymentStateRequest request = new FetchDeploymentStateRequest { Name = "name1c9368b0", }; FetchDeploymentStateResponse expectedResponse = new FetchDeploymentStateResponse { ClusterState = { new FetchDeploymentStateResponse.Types.DeployedClusterState(), }, Unavailable = { "unavailable48e06070", }, }; mockGrpcClient.Setup(x => x.FetchDeploymentStateAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <FetchDeploymentStateResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GameServerDeploymentsServiceClient client = new GameServerDeploymentsServiceClientImpl(mockGrpcClient.Object, null); FetchDeploymentStateResponse responseCallSettings = await client.FetchDeploymentStateAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); FetchDeploymentStateResponse responseCancellationToken = await client.FetchDeploymentStateAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void FetchDeploymentStateRequestObject() { moq::Mock <GameServerDeploymentsService.GameServerDeploymentsServiceClient> mockGrpcClient = new moq::Mock <GameServerDeploymentsService.GameServerDeploymentsServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); FetchDeploymentStateRequest request = new FetchDeploymentStateRequest { Name = "name1c9368b0", }; FetchDeploymentStateResponse expectedResponse = new FetchDeploymentStateResponse { ClusterState = { new FetchDeploymentStateResponse.Types.DeployedClusterState(), }, Unavailable = { "unavailable48e06070", }, }; mockGrpcClient.Setup(x => x.FetchDeploymentState(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GameServerDeploymentsServiceClient client = new GameServerDeploymentsServiceClientImpl(mockGrpcClient.Object, null); FetchDeploymentStateResponse response = client.FetchDeploymentState(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }