public void GetApprovalRequest() { moq::Mock <AccessApprovalService.AccessApprovalServiceClient> mockGrpcClient = new moq::Mock <AccessApprovalService.AccessApprovalServiceClient>(moq::MockBehavior.Strict); GetApprovalRequestMessage request = new GetApprovalRequestMessage { Name = "name1c9368b0", }; ApprovalRequest expectedResponse = new ApprovalRequest { Name = "name1c9368b0", RequestedResourceName = "requested_resource_name3898f866", RequestedReason = new AccessReason(), RequestedLocations = new AccessLocations(), RequestTime = new wkt::Timestamp(), RequestedExpiration = new wkt::Timestamp(), Approve = new ApproveDecision(), Dismiss = new DismissDecision(), RequestedResourceProperties = new ResourceProperties(), }; mockGrpcClient.Setup(x => x.GetApprovalRequest(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AccessApprovalServiceClient client = new AccessApprovalServiceClientImpl(mockGrpcClient.Object, null); ApprovalRequest response = client.GetApprovalRequest(request.Name); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetApprovalRequestRequestObjectAsync() { moq::Mock <AccessApprovalService.AccessApprovalServiceClient> mockGrpcClient = new moq::Mock <AccessApprovalService.AccessApprovalServiceClient>(moq::MockBehavior.Strict); GetApprovalRequestMessage request = new GetApprovalRequestMessage { Name = "name1c9368b0", }; ApprovalRequest expectedResponse = new ApprovalRequest { Name = "name1c9368b0", RequestedResourceName = "requested_resource_name3898f866", RequestedReason = new AccessReason(), RequestedLocations = new AccessLocations(), RequestTime = new wkt::Timestamp(), RequestedExpiration = new wkt::Timestamp(), Approve = new ApproveDecision(), Dismiss = new DismissDecision(), RequestedResourceProperties = new ResourceProperties(), }; mockGrpcClient.Setup(x => x.GetApprovalRequestAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ApprovalRequest>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AccessApprovalServiceClient client = new AccessApprovalServiceClientImpl(mockGrpcClient.Object, null); ApprovalRequest responseCallSettings = await client.GetApprovalRequestAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ApprovalRequest responseCancellationToken = await client.GetApprovalRequestAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task UpdateAccessApprovalSettingsAsync() { moq::Mock <AccessApprovalService.AccessApprovalServiceClient> mockGrpcClient = new moq::Mock <AccessApprovalService.AccessApprovalServiceClient>(moq::MockBehavior.Strict); UpdateAccessApprovalSettingsMessage request = new UpdateAccessApprovalSettingsMessage { Settings = new AccessApprovalSettings(), UpdateMask = new wkt::FieldMask(), }; AccessApprovalSettings expectedResponse = new AccessApprovalSettings { Name = "name1c9368b0", NotificationEmails = { "notification_emails936d0793", }, EnrolledServices = { new EnrolledService(), }, EnrolledAncestor = true, }; mockGrpcClient.Setup(x => x.UpdateAccessApprovalSettingsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AccessApprovalSettings>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AccessApprovalServiceClient client = new AccessApprovalServiceClientImpl(mockGrpcClient.Object, null); AccessApprovalSettings responseCallSettings = await client.UpdateAccessApprovalSettingsAsync(request.Settings, request.UpdateMask, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AccessApprovalSettings responseCancellationToken = await client.UpdateAccessApprovalSettingsAsync(request.Settings, request.UpdateMask, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void UpdateAccessApprovalSettings() { moq::Mock <AccessApprovalService.AccessApprovalServiceClient> mockGrpcClient = new moq::Mock <AccessApprovalService.AccessApprovalServiceClient>(moq::MockBehavior.Strict); UpdateAccessApprovalSettingsMessage request = new UpdateAccessApprovalSettingsMessage { Settings = new AccessApprovalSettings(), UpdateMask = new wkt::FieldMask(), }; AccessApprovalSettings expectedResponse = new AccessApprovalSettings { Name = "name1c9368b0", NotificationEmails = { "notification_emails936d0793", }, EnrolledServices = { new EnrolledService(), }, EnrolledAncestor = true, }; mockGrpcClient.Setup(x => x.UpdateAccessApprovalSettings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AccessApprovalServiceClient client = new AccessApprovalServiceClientImpl(mockGrpcClient.Object, null); AccessApprovalSettings response = client.UpdateAccessApprovalSettings(request.Settings, request.UpdateMask); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void DeleteAccessApprovalSettings() { moq::Mock <AccessApprovalService.AccessApprovalServiceClient> mockGrpcClient = new moq::Mock <AccessApprovalService.AccessApprovalServiceClient>(moq::MockBehavior.Strict); DeleteAccessApprovalSettingsMessage request = new DeleteAccessApprovalSettingsMessage { Name = "name1c9368b0", }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteAccessApprovalSettings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AccessApprovalServiceClient client = new AccessApprovalServiceClientImpl(mockGrpcClient.Object, null); client.DeleteAccessApprovalSettings(request.Name); mockGrpcClient.VerifyAll(); }
public async stt::Task DeleteAccessApprovalSettingsAsync() { moq::Mock <AccessApprovalService.AccessApprovalServiceClient> mockGrpcClient = new moq::Mock <AccessApprovalService.AccessApprovalServiceClient>(moq::MockBehavior.Strict); DeleteAccessApprovalSettingsMessage request = new DeleteAccessApprovalSettingsMessage { Name = "name1c9368b0", }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteAccessApprovalSettingsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AccessApprovalServiceClient client = new AccessApprovalServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteAccessApprovalSettingsAsync(request.Name, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteAccessApprovalSettingsAsync(request.Name, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }