private static WindowsPhoneToastPushNotificationMessage GetValidWindowsPhoneToastPushNotificationMessage() { var message = new WindowsPhoneToastPushNotificationMessage() { NotificationUri = WindowsPhonePushNotificationMessageUnitTest.ChannelUri, Text1 = "Toast Header", Text2 = "Toast Text", }; return message; }
/// <summary> /// Validates the Windows Phone Toast Notification Message for the rules set forth by the Notification System. /// </summary> /// <param name="windowsPhoneToastPushNotificationMessage">The notification message to be validated.</param> /// <param name="vrs">The uber validation results.</param> private static void ValidateWindowsPhoneToastPushNotificationMessage(WindowsPhoneToastPushNotificationMessage windowsPhoneToastPushNotificationMessage, ValidationResults vrs) { if (windowsPhoneToastPushNotificationMessage.DeviceType != DeviceType.WindowsPhone7_1 && !String.IsNullOrWhiteSpace(windowsPhoneToastPushNotificationMessage.Param)) { vrs.Add(new ValidationResult() { ValidationMessageType = ValidationMessageType.Warning, MessageWithCode = StringResources.Code_0004, }); } if (windowsPhoneToastPushNotificationMessage.DeviceType == DeviceType.WindowsPhone7_1 && !String.IsNullOrWhiteSpace(windowsPhoneToastPushNotificationMessage.Param)) { if (windowsPhoneToastPushNotificationMessage.Param.ToValidXmlCharacters(windowsPhoneToastPushNotificationMessage.EscapeInvalidCharacters).Length > 256) { vrs.Add(new ValidationResult(StringResources.Code_0003)); } } }