Exemple #1
0
        public async stt::Task GetCustomerUserAccessRequestObjectAsync()
        {
            moq::Mock <CustomerUserAccessService.CustomerUserAccessServiceClient> mockGrpcClient = new moq::Mock <CustomerUserAccessService.CustomerUserAccessServiceClient>(moq::MockBehavior.Strict);
            GetCustomerUserAccessRequest request = new GetCustomerUserAccessRequest
            {
                ResourceNameAsCustomerUserAccessName = gagvr::CustomerUserAccessName.FromCustomerUser("[CUSTOMER_ID]", "[USER_ID]"),
            };
            gagvr::CustomerUserAccess expectedResponse = new gagvr::CustomerUserAccess
            {
                ResourceNameAsCustomerUserAccessName = gagvr::CustomerUserAccessName.FromCustomerUser("[CUSTOMER_ID]", "[USER_ID]"),
                UserId                  = -7972883667886640920L,
                EmailAddress            = "email_addressf3aae0b5",
                AccessRole              = gagve::AccessRoleEnum.Types.AccessRole.Unspecified,
                AccessCreationDateTime  = "access_creation_date_time7709b5b1",
                InviterUserEmailAddress = "inviter_user_email_address38e90785",
            };

            mockGrpcClient.Setup(x => x.GetCustomerUserAccessAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::CustomerUserAccess>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CustomerUserAccessServiceClient client = new CustomerUserAccessServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CustomerUserAccess       responseCallSettings = await client.GetCustomerUserAccessAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::CustomerUserAccess responseCancellationToken = await client.GetCustomerUserAccessAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCustomerUserAccess()
        {
            moq::Mock <CustomerUserAccessService.CustomerUserAccessServiceClient> mockGrpcClient = new moq::Mock <CustomerUserAccessService.CustomerUserAccessServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerUserAccessRequest request = new MutateCustomerUserAccessRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operation  = new CustomerUserAccessOperation(),
            };
            MutateCustomerUserAccessResponse expectedResponse = new MutateCustomerUserAccessResponse
            {
                Result = new MutateCustomerUserAccessResult(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerUserAccess(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerUserAccessServiceClient  client   = new CustomerUserAccessServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerUserAccessResponse response = client.MutateCustomerUserAccess(request.CustomerId, request.Operation);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task MutateCustomerUserAccessAsync()
        {
            moq::Mock <CustomerUserAccessService.CustomerUserAccessServiceClient> mockGrpcClient = new moq::Mock <CustomerUserAccessService.CustomerUserAccessServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerUserAccessRequest request = new MutateCustomerUserAccessRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operation  = new CustomerUserAccessOperation(),
            };
            MutateCustomerUserAccessResponse expectedResponse = new MutateCustomerUserAccessResponse
            {
                Result = new MutateCustomerUserAccessResult(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerUserAccessAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateCustomerUserAccessResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CustomerUserAccessServiceClient  client = new CustomerUserAccessServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerUserAccessResponse responseCallSettings = await client.MutateCustomerUserAccessAsync(request.CustomerId, request.Operation, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateCustomerUserAccessResponse responseCancellationToken = await client.MutateCustomerUserAccessAsync(request.CustomerId, request.Operation, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #4
0
        public void GetCustomerUserAccess()
        {
            moq::Mock <CustomerUserAccessService.CustomerUserAccessServiceClient> mockGrpcClient = new moq::Mock <CustomerUserAccessService.CustomerUserAccessServiceClient>(moq::MockBehavior.Strict);
            GetCustomerUserAccessRequest request = new GetCustomerUserAccessRequest
            {
                ResourceNameAsCustomerUserAccessName = gagvr::CustomerUserAccessName.FromCustomerUser("[CUSTOMER_ID]", "[USER_ID]"),
            };
            gagvr::CustomerUserAccess expectedResponse = new gagvr::CustomerUserAccess
            {
                ResourceNameAsCustomerUserAccessName = gagvr::CustomerUserAccessName.FromCustomerUser("[CUSTOMER_ID]", "[USER_ID]"),
                UserId                  = -7972883667886640920L,
                EmailAddress            = "email_addressf3aae0b5",
                AccessRole              = gagve::AccessRoleEnum.Types.AccessRole.Unspecified,
                AccessCreationDateTime  = "access_creation_date_time7709b5b1",
                InviterUserEmailAddress = "inviter_user_email_address38e90785",
            };

            mockGrpcClient.Setup(x => x.GetCustomerUserAccess(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerUserAccessServiceClient client   = new CustomerUserAccessServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CustomerUserAccess       response = client.GetCustomerUserAccess(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }