public async stt::Task GetGameServerDeploymentRolloutResourceNamesAsync() { 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); GetGameServerDeploymentRolloutRequest request = new GetGameServerDeploymentRolloutRequest { GameServerDeploymentName = GameServerDeploymentName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"), }; GameServerDeploymentRollout expectedResponse = new GameServerDeploymentRollout { GameServerDeploymentRolloutName = GameServerDeploymentRolloutName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), DefaultGameServerConfig = "default_game_server_config2214de2f", GameServerConfigOverrides = { new GameServerConfigOverride(), }, Etag = "etage8ad7218", }; mockGrpcClient.Setup(x => x.GetGameServerDeploymentRolloutAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GameServerDeploymentRollout>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GameServerDeploymentsServiceClient client = new GameServerDeploymentsServiceClientImpl(mockGrpcClient.Object, null); GameServerDeploymentRollout responseCallSettings = await client.GetGameServerDeploymentRolloutAsync(request.GameServerDeploymentName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); GameServerDeploymentRollout responseCancellationToken = await client.GetGameServerDeploymentRolloutAsync(request.GameServerDeploymentName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetGameServerDeploymentRolloutResourceNames() { 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); GetGameServerDeploymentRolloutRequest request = new GetGameServerDeploymentRolloutRequest { GameServerDeploymentName = GameServerDeploymentName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"), }; GameServerDeploymentRollout expectedResponse = new GameServerDeploymentRollout { GameServerDeploymentRolloutName = GameServerDeploymentRolloutName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), DefaultGameServerConfig = "default_game_server_config2214de2f", GameServerConfigOverrides = { new GameServerConfigOverride(), }, Etag = "etage8ad7218", }; mockGrpcClient.Setup(x => x.GetGameServerDeploymentRollout(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GameServerDeploymentsServiceClient client = new GameServerDeploymentsServiceClientImpl(mockGrpcClient.Object, null); GameServerDeploymentRollout response = client.GetGameServerDeploymentRollout(request.GameServerDeploymentName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }