in FirebaseAdmin/FirebaseAdmin.IntegrationTests/FirebaseMessagingTest.cs [56:96]
public async Task SendAll()
{
var message1 = new Message()
{
Topic = "foo-bar",
Notification = new Notification()
{
Title = "Title",
Body = "Body",
ImageUrl = "https://example.com/image.png",
},
Android = new AndroidConfig()
{
Priority = Priority.Normal,
TimeToLive = TimeSpan.FromHours(1),
RestrictedPackageName = "com.google.firebase.testing",
},
};
var message2 = new Message()
{
Topic = "fiz-buz",
Notification = new Notification()
{
Title = "Title",
Body = "Body",
},
Android = new AndroidConfig()
{
Priority = Priority.Normal,
TimeToLive = TimeSpan.FromHours(1),
RestrictedPackageName = "com.google.firebase.testing",
},
};
var response = await FirebaseMessaging.DefaultInstance.SendAllAsync(new[] { message1, message2 }, dryRun: true);
Assert.NotNull(response);
Assert.Equal(2, response.SuccessCount);
Assert.True(!string.IsNullOrEmpty(response.Responses[0].MessageId));
Assert.Matches(new Regex("^projects/.*/messages/.*$"), response.Responses[0].MessageId);
Assert.True(!string.IsNullOrEmpty(response.Responses[1].MessageId));
Assert.Matches(new Regex("^projects/.*/messages/.*$"), response.Responses[1].MessageId);
}