public void CreateTransferJobRequestObject() { moq::Mock <StorageTransferService.StorageTransferServiceClient> mockGrpcClient = new moq::Mock <StorageTransferService.StorageTransferServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CreateTransferJobRequest request = new CreateTransferJobRequest { TransferJob = new TransferJob(), }; TransferJob expectedResponse = new TransferJob { Name = "name1c9368b0", Description = "description2cf9da67", ProjectId = "project_id43ad98b0", TransferSpec = new TransferSpec(), Schedule = new Schedule(), Status = TransferJob.Types.Status.Disabled, CreationTime = new wkt::Timestamp(), LastModificationTime = new wkt::Timestamp(), DeletionTime = new wkt::Timestamp(), NotificationConfig = new NotificationConfig(), LatestOperationName = "latest_operation_namef5a455e9", }; mockGrpcClient.Setup(x => x.CreateTransferJob(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); StorageTransferServiceClient client = new StorageTransferServiceClientImpl(mockGrpcClient.Object, null); TransferJob response = client.CreateTransferJob(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetGoogleServiceAccountRequestObjectAsync() { moq::Mock <StorageTransferService.StorageTransferServiceClient> mockGrpcClient = new moq::Mock <StorageTransferService.StorageTransferServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetGoogleServiceAccountRequest request = new GetGoogleServiceAccountRequest { ProjectId = "project_id43ad98b0", }; GoogleServiceAccount expectedResponse = new GoogleServiceAccount { AccountEmail = "account_email01cc68b0", SubjectId = "subject_idd1a1abff", }; mockGrpcClient.Setup(x => x.GetGoogleServiceAccountAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GoogleServiceAccount>(stt::Task.FromResult(expectedResponse), null, null, null, null)); StorageTransferServiceClient client = new StorageTransferServiceClientImpl(mockGrpcClient.Object, null); GoogleServiceAccount responseCallSettings = await client.GetGoogleServiceAccountAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); GoogleServiceAccount responseCancellationToken = await client.GetGoogleServiceAccountAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task GetTransferJobRequestObjectAsync() { moq::Mock <StorageTransferService.StorageTransferServiceClient> mockGrpcClient = new moq::Mock <StorageTransferService.StorageTransferServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetTransferJobRequest request = new GetTransferJobRequest { JobName = "job_namedc176648", ProjectId = "project_id43ad98b0", }; TransferJob expectedResponse = new TransferJob { Name = "name1c9368b0", Description = "description2cf9da67", ProjectId = "project_id43ad98b0", TransferSpec = new TransferSpec(), Schedule = new Schedule(), Status = TransferJob.Types.Status.Disabled, CreationTime = new wkt::Timestamp(), LastModificationTime = new wkt::Timestamp(), DeletionTime = new wkt::Timestamp(), NotificationConfig = new NotificationConfig(), LatestOperationName = "latest_operation_namef5a455e9", }; mockGrpcClient.Setup(x => x.GetTransferJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TransferJob>(stt::Task.FromResult(expectedResponse), null, null, null, null)); StorageTransferServiceClient client = new StorageTransferServiceClientImpl(mockGrpcClient.Object, null); TransferJob responseCallSettings = await client.GetTransferJobAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); TransferJob responseCancellationToken = await client.GetTransferJobAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void ResumeTransferOperationRequestObject() { moq::Mock <StorageTransferService.StorageTransferServiceClient> mockGrpcClient = new moq::Mock <StorageTransferService.StorageTransferServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ResumeTransferOperationRequest request = new ResumeTransferOperationRequest { Name = "name1c9368b0", }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.ResumeTransferOperation(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); StorageTransferServiceClient client = new StorageTransferServiceClientImpl(mockGrpcClient.Object, null); client.ResumeTransferOperation(request); mockGrpcClient.VerifyAll(); }
public async stt::Task ResumeTransferOperationRequestObjectAsync() { moq::Mock <StorageTransferService.StorageTransferServiceClient> mockGrpcClient = new moq::Mock <StorageTransferService.StorageTransferServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ResumeTransferOperationRequest request = new ResumeTransferOperationRequest { Name = "name1c9368b0", }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.ResumeTransferOperationAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); StorageTransferServiceClient client = new StorageTransferServiceClientImpl(mockGrpcClient.Object, null); await client.ResumeTransferOperationAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.ResumeTransferOperationAsync(request, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public void GetGoogleServiceAccountRequestObject() { moq::Mock <StorageTransferService.StorageTransferServiceClient> mockGrpcClient = new moq::Mock <StorageTransferService.StorageTransferServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetGoogleServiceAccountRequest request = new GetGoogleServiceAccountRequest { ProjectId = "project_id43ad98b0", }; GoogleServiceAccount expectedResponse = new GoogleServiceAccount { AccountEmail = "account_email01cc68b0", SubjectId = "subject_idd1a1abff", }; mockGrpcClient.Setup(x => x.GetGoogleServiceAccount(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); StorageTransferServiceClient client = new StorageTransferServiceClientImpl(mockGrpcClient.Object, null); GoogleServiceAccount response = client.GetGoogleServiceAccount(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }