SendFcmV1NativeNotificationAsync is missing in INotificationHubClient

Emanuele 0 Reputation points
2025-09-26T14:45:46.13+00:00

I'm trying to use the dependency injection when using the NotificationHubClient, for this I'm trying to use the INotificationHubClient but there the method SendFcmV1NativeNotificationAsync is missing while it is available in it's implementation NotificationHubClient class.

In this way it is really hard to perform unit tests on the methods that are using SendFcmV1NativeNotificationAsync without transforming them into integration tests, but I don't want to create a resource just for test purpose

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
{count} votes

1 answer

Sort by: Most helpful
  1. Vimal Lalani 1,820 Reputation points Microsoft External Staff Moderator
    2025-09-30T08:36:46.4266667+00:00

    Hi Emanuele

    Yes, I got the point.

    The official documentation for Microsoft.Azure.NotificationHubs (v4.1.0) is available, but it does not include the SendFcmV1NativeNotificationAsync method. In version 4.2.0, the method is available in the concrete class but not in the interface.

    Would it be possible to create a new interface and class structure like this:

    INotificationHubV1Client inherits from INotificationHubClient

    NotificationHubV1Client inherits from NotificationHubClient and implements INotificationHubV1Client

    This way, you can extend the functionality without breaking the existing interface.

    public interface INotificationHubV1Client : INotificationHubClient
    {
        public Task<NotificationOutcome> SendFcmV1NativeNotificationAsync(string jsonPayload);
    }
    public class NotificationHubV1Client : NotificationHubClient, INotificationHubV1Client
    {
        public NotificationHubV1Client(string connectionString, string notificationHubPath) : base(connectionString, notificationHubPath)
        {
        }
    }
    

    and then.

    INotificationHubV1Client _notificationHubClient = new NotificationHubV1Client("", "");
    await _notificationHubClient.SendFcmV1NativeNotificationAsync("");
    
    

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.