public async stt::Task GetGameServerConfigRequestObjectAsync() { moq::Mock <GameServerConfigsService.GameServerConfigsServiceClient> mockGrpcClient = new moq::Mock <GameServerConfigsService.GameServerConfigsServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetGameServerConfigRequest request = new GetGameServerConfigRequest { GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"), }; GameServerConfig expectedResponse = new GameServerConfig { GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, FleetConfigs = { new FleetConfig(), }, ScalingConfigs = { new ScalingConfig(), }, Description = "description2cf9da67", }; mockGrpcClient.Setup(x => x.GetGameServerConfigAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GameServerConfig>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GameServerConfigsServiceClient client = new GameServerConfigsServiceClientImpl(mockGrpcClient.Object, null); GameServerConfig responseCallSettings = await client.GetGameServerConfigAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); GameServerConfig responseCancellationToken = await client.GetGameServerConfigAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetGameServerConfigRequestObject() { moq::Mock <GameServerConfigsService.GameServerConfigsServiceClient> mockGrpcClient = new moq::Mock <GameServerConfigsService.GameServerConfigsServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetGameServerConfigRequest request = new GetGameServerConfigRequest { GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"), }; GameServerConfig expectedResponse = new GameServerConfig { GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, FleetConfigs = { new FleetConfig(), }, ScalingConfigs = { new ScalingConfig(), }, Description = "description2cf9da67", }; mockGrpcClient.Setup(x => x.GetGameServerConfig(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GameServerConfigsServiceClient client = new GameServerConfigsServiceClientImpl(mockGrpcClient.Object, null); GameServerConfig response = client.GetGameServerConfig(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }