public async stt::Task GetCustomerExtensionSettingRequestObjectAsync()
        {
            moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(moq::MockBehavior.Strict);
            GetCustomerExtensionSettingRequest request = new GetCustomerExtensionSettingRequest
            {
                ResourceNameAsCustomerExtensionSettingName = gagvr::CustomerExtensionSettingName.FromCustomerCustomerExtensionSetting("[CUSTOMER]", "[CUSTOMER_EXTENSION_SETTING]"),
            };
            gagvr::CustomerExtensionSetting expectedResponse = new gagvr::CustomerExtensionSetting
            {
                ResourceNameAsCustomerExtensionSettingName = gagvr::CustomerExtensionSettingName.FromCustomerCustomerExtensionSetting("[CUSTOMER]", "[CUSTOMER_EXTENSION_SETTING]"),
                ExtensionType = gagve::ExtensionTypeEnum.Types.ExtensionType.Promotion,
                ExtensionFeedItemsAsExtensionFeedItemNames =
                {
                    gagvr::ExtensionFeedItemName.FromCustomerExtensionFeedItem("[CUSTOMER]", "[EXTENSION_FEED_ITEM]"),
                },
                Device = gagve::ExtensionSettingDeviceEnum.Types.ExtensionSettingDevice.Unknown,
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            gagvr::CustomerExtensionSetting responseCancellationToken = await client.GetCustomerExtensionSettingAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public async Task GetCustomerExtensionSettingAsync2()
        {
            Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(MockBehavior.Strict);
            GetCustomerExtensionSettingRequest request = new GetCustomerExtensionSettingRequest
            {
                ResourceName = new CustomerExtensionSettingName("[CUSTOMER]", "[CUSTOMER_EXTENSION_SETTING]").ToString(),
            };
            CustomerExtensionSetting expectedResponse = new CustomerExtensionSetting
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomerExtensionSettingAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CustomerExtensionSetting>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerExtensionSettingServiceClient client = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null);
            CustomerExtensionSetting response            = await client.GetCustomerExtensionSettingAsync(request);

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