public async stt::Task GetMigrationWorkflowResourceNamesAsync() { moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict); GetMigrationWorkflowRequest request = new GetMigrationWorkflowRequest { MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"), }; MigrationWorkflow expectedResponse = new MigrationWorkflow { MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"), Tasks = { { "key8a0b6e3c", new MigrationTask() }, }, State = MigrationWorkflow.Types.State.Paused, CreateTime = new wkt::Timestamp(), LastUpdateTime = new wkt::Timestamp(), DisplayName = "display_name137f65c2", }; mockGrpcClient.Setup(x => x.GetMigrationWorkflowAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MigrationWorkflow>(stt::Task.FromResult(expectedResponse), null, null, null, null)); MigrationServiceClient client = new MigrationServiceClientImpl(mockGrpcClient.Object, null); MigrationWorkflow responseCallSettings = await client.GetMigrationWorkflowAsync(request.MigrationWorkflowName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MigrationWorkflow responseCancellationToken = await client.GetMigrationWorkflowAsync(request.MigrationWorkflowName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetMigrationWorkflowResourceNames() { moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict); GetMigrationWorkflowRequest request = new GetMigrationWorkflowRequest { MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"), }; MigrationWorkflow expectedResponse = new MigrationWorkflow { MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"), Tasks = { { "key8a0b6e3c", new MigrationTask() }, }, State = MigrationWorkflow.Types.State.Paused, CreateTime = new wkt::Timestamp(), LastUpdateTime = new wkt::Timestamp(), DisplayName = "display_name137f65c2", }; mockGrpcClient.Setup(x => x.GetMigrationWorkflow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MigrationServiceClient client = new MigrationServiceClientImpl(mockGrpcClient.Object, null); MigrationWorkflow response = client.GetMigrationWorkflow(request.MigrationWorkflowName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetMigrationWorkflow</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetMigrationWorkflowRequestObject() { // Create client MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create(); // Initialize request argument(s) GetMigrationWorkflowRequest request = new GetMigrationWorkflowRequest { MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"), ReadMask = new FieldMask(), }; // Make the request MigrationWorkflow response = migrationServiceClient.GetMigrationWorkflow(request); }