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(); }
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 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(); }
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(); }
public void StartMigrationWorkflowResourceNames() { moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict); StartMigrationWorkflowRequest request = new StartMigrationWorkflowRequest { MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.StartMigrationWorkflow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MigrationServiceClient client = new MigrationServiceClientImpl(mockGrpcClient.Object, null); client.StartMigrationWorkflow(request.MigrationWorkflowName); mockGrpcClient.VerifyAll(); }
public async stt::Task StartMigrationWorkflowResourceNamesAsync() { moq::Mock <MigrationService.MigrationServiceClient> mockGrpcClient = new moq::Mock <MigrationService.MigrationServiceClient>(moq::MockBehavior.Strict); StartMigrationWorkflowRequest request = new StartMigrationWorkflowRequest { MigrationWorkflowName = MigrationWorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.StartMigrationWorkflowAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); MigrationServiceClient client = new MigrationServiceClientImpl(mockGrpcClient.Object, null); await client.StartMigrationWorkflowAsync(request.MigrationWorkflowName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.StartMigrationWorkflowAsync(request.MigrationWorkflowName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }