public void UpdateCatalogItemResourceNames() { moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); UpdateCatalogItemRequest request = new UpdateCatalogItemRequest { CatalogItemPathName = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"), CatalogItem = new CatalogItem(), UpdateMask = new wkt::FieldMask(), }; CatalogItem expectedResponse = new CatalogItem { Id = "id74b70bb8", CategoryHierarchies = { new CatalogItem.Types.CategoryHierarchy(), }, Title = "title17dbd3d5", Description = "description2cf9da67", ItemAttributes = new FeatureMap(), LanguageCode = "language_code2f6c7160", Tags = { "tags52c47ad5", }, ItemGroupId = "item_group_id08a4c0f5", ProductMetadata = new ProductCatalogItem(), }; mockGrpcClient.Setup(x => x.UpdateCatalogItem(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null); CatalogItem response = client.UpdateCatalogItem(request.CatalogItemPathName, request.CatalogItem, request.UpdateMask); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetCatalogItemResourceNamesAsync() { moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetCatalogItemRequest request = new GetCatalogItemRequest { CatalogItemPathName = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"), }; CatalogItem expectedResponse = new CatalogItem { Id = "id74b70bb8", CategoryHierarchies = { new CatalogItem.Types.CategoryHierarchy(), }, Title = "title17dbd3d5", Description = "description2cf9da67", ItemAttributes = new FeatureMap(), LanguageCode = "language_code2f6c7160", Tags = { "tags52c47ad5", }, ItemGroupId = "item_group_id08a4c0f5", ProductMetadata = new ProductCatalogItem(), }; mockGrpcClient.Setup(x => x.GetCatalogItemAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CatalogItem>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null); CatalogItem responseCallSettings = await client.GetCatalogItemAsync(request.CatalogItemPathName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); CatalogItem responseCancellationToken = await client.GetCatalogItemAsync(request.CatalogItemPathName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetCatalogItem</summary> public void GetCatalogItemResourceNames() { // Snippet: GetCatalogItem(CatalogItemPathName, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) CatalogItemPathName name = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"); // Make the request CatalogItem response = catalogServiceClient.GetCatalogItem(name); // End snippet }
/// <summary>Snippet for UpdateCatalogItem</summary> public void UpdateCatalogItemResourceNames() { // Snippet: UpdateCatalogItem(CatalogItemPathName, CatalogItem, FieldMask, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) CatalogItemPathName name = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"); CatalogItem catalogItem = new CatalogItem(); FieldMask updateMask = new FieldMask(); // Make the request CatalogItem response = catalogServiceClient.UpdateCatalogItem(name, catalogItem, updateMask); // End snippet }
/// <summary>Snippet for DeleteCatalogItemAsync</summary> public async Task DeleteCatalogItemResourceNamesAsync() { // Snippet: DeleteCatalogItemAsync(CatalogItemPathName, CallSettings) // Additional: DeleteCatalogItemAsync(CatalogItemPathName, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) CatalogItemPathName name = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"); // Make the request await catalogServiceClient.DeleteCatalogItemAsync(name); // End snippet }
/// <summary>Snippet for DeleteCatalogItem</summary> public void DeleteCatalogItemRequestObject() { // Snippet: DeleteCatalogItem(DeleteCatalogItemRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) DeleteCatalogItemRequest request = new DeleteCatalogItemRequest { CatalogItemPathName = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"), }; // Make the request catalogServiceClient.DeleteCatalogItem(request); // End snippet }
/// <summary>Snippet for UpdateCatalogItem</summary> public void UpdateCatalogItemRequestObject() { // Snippet: UpdateCatalogItem(UpdateCatalogItemRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) UpdateCatalogItemRequest request = new UpdateCatalogItemRequest { CatalogItemPathName = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"), CatalogItem = new CatalogItem(), UpdateMask = new FieldMask(), }; // Make the request CatalogItem response = catalogServiceClient.UpdateCatalogItem(request); // End snippet }
/// <summary>Snippet for GetCatalogItemAsync</summary> public async Task GetCatalogItemRequestObjectAsync() { // Snippet: GetCatalogItemAsync(GetCatalogItemRequest, CallSettings) // Additional: GetCatalogItemAsync(GetCatalogItemRequest, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) GetCatalogItemRequest request = new GetCatalogItemRequest { CatalogItemPathName = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"), }; // Make the request CatalogItem response = await catalogServiceClient.GetCatalogItemAsync(request); // End snippet }
public void DeleteCatalogItemResourceNames() { moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); DeleteCatalogItemRequest request = new DeleteCatalogItemRequest { CatalogItemPathName = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteCatalogItem(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null); client.DeleteCatalogItem(request.CatalogItemPathName); mockGrpcClient.VerifyAll(); }
public async stt::Task DeleteCatalogItemResourceNamesAsync() { moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); DeleteCatalogItemRequest request = new DeleteCatalogItemRequest { CatalogItemPathName = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteCatalogItemAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteCatalogItemAsync(request.CatalogItemPathName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteCatalogItemAsync(request.CatalogItemPathName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }