public void MutateAssetGroupAssets()
        {
            moq::Mock <AssetGroupAssetService.AssetGroupAssetServiceClient> mockGrpcClient = new moq::Mock <AssetGroupAssetService.AssetGroupAssetServiceClient>(moq::MockBehavior.Strict);
            MutateAssetGroupAssetsRequest request = new MutateAssetGroupAssetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new AssetGroupAssetOperation(),
                },
            };
            MutateAssetGroupAssetsResponse expectedResponse = new MutateAssetGroupAssetsResponse
            {
                Results =
                {
                    new MutateAssetGroupAssetResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateAssetGroupAssets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AssetGroupAssetServiceClient   client   = new AssetGroupAssetServiceClientImpl(mockGrpcClient.Object, null);
            MutateAssetGroupAssetsResponse response = client.MutateAssetGroupAssets(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 2
0
        public void GetAssetGroupAsset()
        {
            moq::Mock <AssetGroupAssetService.AssetGroupAssetServiceClient> mockGrpcClient = new moq::Mock <AssetGroupAssetService.AssetGroupAssetServiceClient>(moq::MockBehavior.Strict);
            GetAssetGroupAssetRequest request = new GetAssetGroupAssetRequest
            {
                ResourceNameAsAssetGroupAssetName = gagvr::AssetGroupAssetName.FromCustomerAssetGroupAssetFieldType("[CUSTOMER_ID]", "[ASSET_GROUP_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
            };
            gagvr::AssetGroupAsset expectedResponse = new gagvr::AssetGroupAsset
            {
                ResourceNameAsAssetGroupAssetName = gagvr::AssetGroupAssetName.FromCustomerAssetGroupAssetFieldType("[CUSTOMER_ID]", "[ASSET_GROUP_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
                AssetGroupAsAssetGroupName        = gagvr::AssetGroupName.FromCustomerAssetGroup("[CUSTOMER_ID]", "[ASSET_GROUP_ID]"),
                AssetAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
                FieldType        = gagve::AssetFieldTypeEnum.Types.AssetFieldType.Callout,
                Status           = gagve::AssetLinkStatusEnum.Types.AssetLinkStatus.Paused,
                PerformanceLabel = gagve::AssetPerformanceLabelEnum.Types.AssetPerformanceLabel.Pending,
                PolicySummary    = new gagvc::PolicySummary(),
            };

            mockGrpcClient.Setup(x => x.GetAssetGroupAsset(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AssetGroupAssetServiceClient client   = new AssetGroupAssetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::AssetGroupAsset       response = client.GetAssetGroupAsset(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task MutateAssetGroupAssetsRequestObjectAsync()
        {
            moq::Mock <AssetGroupAssetService.AssetGroupAssetServiceClient> mockGrpcClient = new moq::Mock <AssetGroupAssetService.AssetGroupAssetServiceClient>(moq::MockBehavior.Strict);
            MutateAssetGroupAssetsRequest request = new MutateAssetGroupAssetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new AssetGroupAssetOperation(),
                },
                PartialFailure = false,
                ValidateOnly   = true,
            };
            MutateAssetGroupAssetsResponse expectedResponse = new MutateAssetGroupAssetsResponse
            {
                Results =
                {
                    new MutateAssetGroupAssetResult(),
                },
                PartialFailureError = new gr::Status(),
            };

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

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateAssetGroupAssetsResponse responseCancellationToken = await client.MutateAssetGroupAssetsAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 4
0
        public async stt::Task GetAssetGroupAssetRequestObjectAsync()
        {
            moq::Mock <AssetGroupAssetService.AssetGroupAssetServiceClient> mockGrpcClient = new moq::Mock <AssetGroupAssetService.AssetGroupAssetServiceClient>(moq::MockBehavior.Strict);
            GetAssetGroupAssetRequest request = new GetAssetGroupAssetRequest
            {
                ResourceNameAsAssetGroupAssetName = gagvr::AssetGroupAssetName.FromCustomerAssetGroupAssetFieldType("[CUSTOMER_ID]", "[ASSET_GROUP_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
            };
            gagvr::AssetGroupAsset expectedResponse = new gagvr::AssetGroupAsset
            {
                ResourceNameAsAssetGroupAssetName = gagvr::AssetGroupAssetName.FromCustomerAssetGroupAssetFieldType("[CUSTOMER_ID]", "[ASSET_GROUP_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
                AssetGroupAsAssetGroupName        = gagvr::AssetGroupName.FromCustomerAssetGroup("[CUSTOMER_ID]", "[ASSET_GROUP_ID]"),
                AssetAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
                FieldType        = gagve::AssetFieldTypeEnum.Types.AssetFieldType.Callout,
                Status           = gagve::AssetLinkStatusEnum.Types.AssetLinkStatus.Paused,
                PerformanceLabel = gagve::AssetPerformanceLabelEnum.Types.AssetPerformanceLabel.Pending,
                PolicySummary    = new gagvc::PolicySummary(),
            };

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

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

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