public async stt::Task GetGroupPlacementViewRequestObjectAsync() { moq::Mock <GroupPlacementViewService.GroupPlacementViewServiceClient> mockGrpcClient = new moq::Mock <GroupPlacementViewService.GroupPlacementViewServiceClient>(moq::MockBehavior.Strict); GetGroupPlacementViewRequest request = new GetGroupPlacementViewRequest { ResourceNameAsGroupPlacementViewName = gagvr::GroupPlacementViewName.FromCustomerAdGroupBase64Placement("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[BASE64_PLACEMENT]"), }; gagvr::GroupPlacementView expectedResponse = new gagvr::GroupPlacementView { ResourceNameAsGroupPlacementViewName = gagvr::GroupPlacementViewName.FromCustomerAdGroupBase64Placement("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[BASE64_PLACEMENT]"), PlacementType = gagve::PlacementTypeEnum.Types.PlacementType.Website, Placement = "placementb440552a", DisplayName = "display_name137f65c2", TargetUrl = "target_url95bdaf9b", }; mockGrpcClient.Setup(x => x.GetGroupPlacementViewAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::GroupPlacementView>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GroupPlacementViewServiceClient client = new GroupPlacementViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::GroupPlacementView responseCallSettings = await client.GetGroupPlacementViewAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); gagvr::GroupPlacementView responseCancellationToken = await client.GetGroupPlacementViewAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetGroupPlacementView() { moq::Mock <GroupPlacementViewService.GroupPlacementViewServiceClient> mockGrpcClient = new moq::Mock <GroupPlacementViewService.GroupPlacementViewServiceClient>(moq::MockBehavior.Strict); GetGroupPlacementViewRequest request = new GetGroupPlacementViewRequest { ResourceNameAsGroupPlacementViewName = gagvr::GroupPlacementViewName.FromCustomerAdGroupBase64Placement("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[BASE64_PLACEMENT]"), }; gagvr::GroupPlacementView expectedResponse = new gagvr::GroupPlacementView { ResourceNameAsGroupPlacementViewName = gagvr::GroupPlacementViewName.FromCustomerAdGroupBase64Placement("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[BASE64_PLACEMENT]"), PlacementType = gagve::PlacementTypeEnum.Types.PlacementType.Website, Placement = "placementb440552a", DisplayName = "display_name137f65c2", TargetUrl = "target_url95bdaf9b", }; mockGrpcClient.Setup(x => x.GetGroupPlacementView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GroupPlacementViewServiceClient client = new GroupPlacementViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::GroupPlacementView response = client.GetGroupPlacementView(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }