public void MissingContentTest() { var message = new PostLikedPush { Body = null, Title = null, BodyLocalizationKey = null, TitleLocalizationKey = null }; Assert.Throws <ValidationException>(() => PlatformNotificationFactory.CreateTemplateProperties(message)); }
public void PropertyPopulationTest() { var message = new PostLikedPush { PostId = Guid.NewGuid() }; var push = PlatformNotificationFactory.CreateTemplateProperties(message); Assert.NotNull(push); Assert.Equal(8, push.Count); Assert.Equal(message.Title, push["title"]); Assert.Equal(message.Body, push["body"]); Assert.Equal(message.BodyLocalizationKey, push["body_loc_key"]); Assert.Equal(message.TitleLocalizationKey, push["title_loc_key"]); Assert.Equal(message.NotificationType.ToString(), push["type"]); Assert.Equal(message.Badge.ToString(), push["badge"]); Assert.Equal(message.Sound, push["sound"]); Assert.Equal(message.PostId, JObject.Parse(push["data"])["postId"]); }