public async stt::Task PreviewUpdateGameServerClusterRequestObjectAsync() { moq::Mock <GameServerClustersService.GameServerClustersServiceClient> mockGrpcClient = new moq::Mock <GameServerClustersService.GameServerClustersServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); PreviewUpdateGameServerClusterRequest request = new PreviewUpdateGameServerClusterRequest { GameServerCluster = new GameServerCluster(), UpdateMask = new wkt::FieldMask(), PreviewTime = new wkt::Timestamp(), }; PreviewUpdateGameServerClusterResponse expectedResponse = new PreviewUpdateGameServerClusterResponse { Etag = "etage8ad7218", TargetState = new TargetState(), }; mockGrpcClient.Setup(x => x.PreviewUpdateGameServerClusterAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <PreviewUpdateGameServerClusterResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GameServerClustersServiceClient client = new GameServerClustersServiceClientImpl(mockGrpcClient.Object, null); PreviewUpdateGameServerClusterResponse responseCallSettings = await client.PreviewUpdateGameServerClusterAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); PreviewUpdateGameServerClusterResponse responseCancellationToken = await client.PreviewUpdateGameServerClusterAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetGameServerClusterRequestObject() { moq::Mock <GameServerClustersService.GameServerClustersServiceClient> mockGrpcClient = new moq::Mock <GameServerClustersService.GameServerClustersServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetGameServerClusterRequest request = new GetGameServerClusterRequest { GameServerClusterName = GameServerClusterName.FromProjectLocationRealmCluster("[PROJECT]", "[LOCATION]", "[REALM]", "[CLUSTER]"), }; GameServerCluster expectedResponse = new GameServerCluster { GameServerClusterName = GameServerClusterName.FromProjectLocationRealmCluster("[PROJECT]", "[LOCATION]", "[REALM]", "[CLUSTER]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, ConnectionInfo = new GameServerClusterConnectionInfo(), Etag = "etage8ad7218", Description = "description2cf9da67", }; mockGrpcClient.Setup(x => x.GetGameServerCluster(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GameServerClustersServiceClient client = new GameServerClustersServiceClientImpl(mockGrpcClient.Object, null); GameServerCluster response = client.GetGameServerCluster(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task PreviewCreateGameServerClusterRequestObjectAsync() { moq::Mock <GameServerClustersService.GameServerClustersServiceClient> mockGrpcClient = new moq::Mock <GameServerClustersService.GameServerClustersServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); PreviewCreateGameServerClusterRequest request = new PreviewCreateGameServerClusterRequest { ParentAsRealmName = RealmName.FromProjectLocationRealm("[PROJECT]", "[LOCATION]", "[REALM]"), GameServerClusterId = "game_server_cluster_ida2310829", GameServerCluster = new GameServerCluster(), PreviewTime = new wkt::Timestamp(), }; PreviewCreateGameServerClusterResponse expectedResponse = new PreviewCreateGameServerClusterResponse { Etag = "etage8ad7218", TargetState = new TargetState(), }; mockGrpcClient.Setup(x => x.PreviewCreateGameServerClusterAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <PreviewCreateGameServerClusterResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GameServerClustersServiceClient client = new GameServerClustersServiceClientImpl(mockGrpcClient.Object, null); PreviewCreateGameServerClusterResponse responseCallSettings = await client.PreviewCreateGameServerClusterAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); PreviewCreateGameServerClusterResponse responseCancellationToken = await client.PreviewCreateGameServerClusterAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void PreviewCreateGameServerClusterRequestObject() { moq::Mock <GameServerClustersService.GameServerClustersServiceClient> mockGrpcClient = new moq::Mock <GameServerClustersService.GameServerClustersServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); PreviewCreateGameServerClusterRequest request = new PreviewCreateGameServerClusterRequest { ParentAsRealmName = RealmName.FromProjectLocationRealm("[PROJECT]", "[LOCATION]", "[REALM]"), GameServerClusterId = "game_server_cluster_ida2310829", GameServerCluster = new GameServerCluster(), PreviewTime = new wkt::Timestamp(), }; PreviewCreateGameServerClusterResponse expectedResponse = new PreviewCreateGameServerClusterResponse { Etag = "etage8ad7218", TargetState = new TargetState(), }; mockGrpcClient.Setup(x => x.PreviewCreateGameServerCluster(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GameServerClustersServiceClient client = new GameServerClustersServiceClientImpl(mockGrpcClient.Object, null); PreviewCreateGameServerClusterResponse response = client.PreviewCreateGameServerCluster(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetGameServerClusterRequestObjectAsync() { moq::Mock <GameServerClustersService.GameServerClustersServiceClient> mockGrpcClient = new moq::Mock <GameServerClustersService.GameServerClustersServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetGameServerClusterRequest request = new GetGameServerClusterRequest { GameServerClusterName = GameServerClusterName.FromProjectLocationRealmCluster("[PROJECT]", "[LOCATION]", "[REALM]", "[CLUSTER]"), View = GameServerClusterView.Basic, }; GameServerCluster expectedResponse = new GameServerCluster { GameServerClusterName = GameServerClusterName.FromProjectLocationRealmCluster("[PROJECT]", "[LOCATION]", "[REALM]", "[CLUSTER]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, ConnectionInfo = new GameServerClusterConnectionInfo(), Etag = "etage8ad7218", Description = "description2cf9da67", ClusterState = new KubernetesClusterState(), }; mockGrpcClient.Setup(x => x.GetGameServerClusterAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GameServerCluster>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GameServerClustersServiceClient client = new GameServerClustersServiceClientImpl(mockGrpcClient.Object, null); GameServerCluster responseCallSettings = await client.GetGameServerClusterAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); GameServerCluster responseCancellationToken = await client.GetGameServerClusterAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void PreviewUpdateGameServerClusterRequestObject() { moq::Mock <GameServerClustersService.GameServerClustersServiceClient> mockGrpcClient = new moq::Mock <GameServerClustersService.GameServerClustersServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); PreviewUpdateGameServerClusterRequest request = new PreviewUpdateGameServerClusterRequest { GameServerCluster = new GameServerCluster(), UpdateMask = new wkt::FieldMask(), PreviewTime = new wkt::Timestamp(), }; PreviewUpdateGameServerClusterResponse expectedResponse = new PreviewUpdateGameServerClusterResponse { Etag = "etage8ad7218", TargetState = new TargetState(), }; mockGrpcClient.Setup(x => x.PreviewUpdateGameServerCluster(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GameServerClustersServiceClient client = new GameServerClustersServiceClientImpl(mockGrpcClient.Object, null); PreviewUpdateGameServerClusterResponse response = client.PreviewUpdateGameServerCluster(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }