public void CreateMigrationWorkflowRequestObject() { moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict); CreateMigrationWorkflowRequest request = new CreateMigrationWorkflowRequest { ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), MigrationWorkflow = new MigrationWorkflow(), }; 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.CreateMigrationWorkflow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MigrationServiceClient client = new MigrationServiceClientImpl(mockGrpcClient.Object, null); MigrationWorkflow response = client.CreateMigrationWorkflow(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task CreateMigrationWorkflowRequestObjectAsync() { moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict); CreateMigrationWorkflowRequest request = new CreateMigrationWorkflowRequest { ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), MigrationWorkflow = new MigrationWorkflow(), }; 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.CreateMigrationWorkflowAsync(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.CreateMigrationWorkflowAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MigrationWorkflow responseCancellationToken = await client.CreateMigrationWorkflowAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for CreateMigrationWorkflow</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateMigrationWorkflowRequestObject() { // Create client MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create(); // Initialize request argument(s) CreateMigrationWorkflowRequest request = new CreateMigrationWorkflowRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), MigrationWorkflow = new MigrationWorkflow(), }; // Make the request MigrationWorkflow response = migrationServiceClient.CreateMigrationWorkflow(request); }