public void GetMigrationSubtaskRequestObject()
        {
            moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict);
            GetMigrationSubtaskRequest request = new GetMigrationSubtaskRequest
            {
                MigrationSubtaskName = MigrationSubtaskName.FromProjectLocationWorkflowSubtask("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[SUBTASK]"),
                ReadMask             = new wkt::FieldMask(),
            };
            MigrationSubtask expectedResponse = new MigrationSubtask
            {
                MigrationSubtaskName = MigrationSubtaskName.FromProjectLocationWorkflowSubtask("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[SUBTASK]"),
                TaskId               = "task_idc86c7457",
                Type                 = "typee2cc9d59",
                State                = MigrationSubtask.Types.State.Succeeded,
                ProcessingError      = new gr::ErrorInfo(),
                CreateTime           = new wkt::Timestamp(),
                LastUpdateTime       = new wkt::Timestamp(),
                Metrics              = { new TimeSeries(), },
                ResourceErrorDetails =
                {
                    new ResourceErrorDetail(),
                },
                ResourceErrorCount = -1309858018,
            };

            mockGrpcClient.Setup(x => x.GetMigrationSubtask(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MigrationServiceClient client   = new MigrationServiceClientImpl(mockGrpcClient.Object, null);
            MigrationSubtask       response = client.GetMigrationSubtask(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task GetMigrationSubtaskResourceNamesAsync()
        {
            moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict);
            GetMigrationSubtaskRequest request = new GetMigrationSubtaskRequest
            {
                MigrationSubtaskName = MigrationSubtaskName.FromProjectLocationWorkflowSubtask("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[SUBTASK]"),
            };
            MigrationSubtask expectedResponse = new MigrationSubtask
            {
                MigrationSubtaskName = MigrationSubtaskName.FromProjectLocationWorkflowSubtask("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[SUBTASK]"),
                TaskId               = "task_idc86c7457",
                Type                 = "typee2cc9d59",
                State                = MigrationSubtask.Types.State.Succeeded,
                ProcessingError      = new gr::ErrorInfo(),
                CreateTime           = new wkt::Timestamp(),
                LastUpdateTime       = new wkt::Timestamp(),
                Metrics              = { new TimeSeries(), },
                ResourceErrorDetails =
                {
                    new ResourceErrorDetail(),
                },
                ResourceErrorCount = -1309858018,
            };

            mockGrpcClient.Setup(x => x.GetMigrationSubtaskAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MigrationSubtask>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            MigrationServiceClient client = new MigrationServiceClientImpl(mockGrpcClient.Object, null);
            MigrationSubtask       responseCallSettings = await client.GetMigrationSubtaskAsync(request.MigrationSubtaskName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            MigrationSubtask responseCancellationToken = await client.GetMigrationSubtaskAsync(request.MigrationSubtaskName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #3
0
 /// <summary>Snippet for GetMigrationSubtask</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetMigrationSubtaskResourceNames()
 {
     // Create client
     MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create();
     // Initialize request argument(s)
     MigrationSubtaskName name = MigrationSubtaskName.FromProjectLocationWorkflowSubtask("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[SUBTASK]");
     // Make the request
     MigrationSubtask response = migrationServiceClient.GetMigrationSubtask(name);
 }
 /// <summary>Snippet for GetMigrationSubtask</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetMigrationSubtaskRequestObject()
 {
     // Create client
     MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create();
     // Initialize request argument(s)
     GetMigrationSubtaskRequest request = new GetMigrationSubtaskRequest
     {
         MigrationSubtaskName = MigrationSubtaskName.FromProjectLocationWorkflowSubtask("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[SUBTASK]"),
         ReadMask             = new FieldMask(),
     };
     // Make the request
     MigrationSubtask response = migrationServiceClient.GetMigrationSubtask(request);
 }