public void SendWindowsPhoneCallbackRegistrationRequestTest()
        {
            var request = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneCallbackRegistrationRequest();
            var result  = PushNotifier.RegisterCallback(request);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnWindowsPhoneCallbackRegistrationResponse(result, ResultType.Success, true, true);
        }
        public void SendWindowsPhone7TilePushNotificationMessageTest()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneTilePushNotificationMessage();

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, true, true);
        }
        public void WindowsPhonePushNotificationMessageNullTest()
        {
            PushNotificationMessage message = null; // it is interesting that an abstract class can be set to null. never knew this.

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, false, "0001");
        }
        public void WindowsPhoneCallbackRegistrationRequestNullTest()
        {
            WindowsPhoneCallbackRegistrationRequest request = null;

            var result = PushNotifier.RegisterCallback(request);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnWindowsPhoneCallbackRegistrationResponse(result, ResultType.Success, false, false, "0012");
        }
        public void WindowsPhoneToastPushNotificationMessageParamLengthGreaterThan256Test()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneToastPushNotificationMessage();

            message.Param = "/MainPage.xaml?v=" + new String('a', 256);

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, false, "0003");
        }
        public void WindowsPhoneCallbackRegistrationRequestCallbackMessageLengthGreaterThan1024Test()
        {
            var request = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneCallbackRegistrationRequest();

            request.CallbackMessage = System.Text.Encoding.Unicode.GetBytes(new String('d', 1030));

            var result = PushNotifier.RegisterCallback(request);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnWindowsPhoneCallbackRegistrationResponse(result, ResultType.Success, false, false, "0015");
        }
        public void WindowsPhoneTilePushNotificationMessageCountGreaterThan99Test()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneTilePushNotificationMessage();

            message.Count = 100;

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, true, "0008");
        }
        public void WindowsPhonePushNotificationMessageMessagePriorityNoneTest()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneToastPushNotificationMessage();

            message.MessagePriority = MessagePriority.None;

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, false, "0011");
        }
        public void WindowsPhonePushNotificationMessageNotificationUriNullTest()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneToastPushNotificationMessage();

            message.NotificationUri = null;

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, false, "0010");
        }
        public void WindowsPhoneToastPushNotificationMessageParamForWindowsPhone7_0Test()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneToastPushNotificationMessage();

            message.SupportWindowsPhone7_0 = true;
            message.Param = "/MainPage.xaml";

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, true, "0004");
        }
        public void WindowsPhoneTilePushNotificationMessageBackBackgroundImageUriForWindowsPhone7_0Test()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneTilePushNotificationMessage();

            message.SupportWindowsPhone7_0 = true;
            message.BackBackgroundImageUri = "http://download-codeplex.sec.s-msft.com/download/Avatar.ashx?DownloadId=266566";

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, true, "0005");
        }
        public void WindowsPhoneTilePushNotificationMessageBackContentForWindowsPhone7_0Test()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneTilePushNotificationMessage();

            message.SupportWindowsPhone7_0 = true;
            message.BackContent            = "Back Content - Profile Image";

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, true, "0007");
        }
Exemple #13
0
        public HttpResponseMessage login(LoginModal model)
        {
            PushNotify _notify = new PushNotify();

            // Check last session exist or not
            if (_userManager.IsAlreadySessionExist(model))
            {
                //remove the all previous sessions of user
                _userManager.ExpirePreviousSessions(model);
                //var lastSession = _userManager.GetLastSessionDetails(model);
                //// if exist then send a notification that your session has expired
                //if (lastSession != null)
                //{

                //if (lastSession.DeviceType == DeviceType.Android)
                //{
                //    var gcmModel = new GCM_Session_Expired()
                //    {
                //        GCM_ID = "GCM_SESSION_EXPIRED",
                //        Message = Messages.GCM_SESSION_EXPIRED
                //    };
                //    var notificationStack = new NotificationStackModel()
                //    {
                //        UserId = lastSession.UserId,
                //        Priority = Priority.High,
                //        Status = BLL.Models.NotificationStatus.Pending,
                //        DeviceId = lastSession.DeviceToken,
                //        Message = gcmModel,
                //    };
                //    var notificatioStack = _notificationStackManager.AddOrUpdateStack(notificationStack);
                //}
                // }
            }
            var result = _userManager.AuthenticateUserOnMobile(model);

            if (result.Status == ActionStatus.Successfull)
            {
                try
                {
                    if (result.Object.DeviceType == (short)DeviceType.IOS)
                    {
                        PushNotifier.NotifyIOSUser(result.Object.DeviceToken, "Login successfully", NotificationType.MessageAlert);
                    }
                }
                catch (Exception ex)
                {
                    _errorLogManager.LogStringExceptionToDatabase(ex.Message);
                }
                return(new JsonContent("Login Successfull", result.Status, result.Object).ConvertToHttpResponseOK());
            }
            return(new JsonContent(result.Message, result.Status).ConvertToHttpResponseOK());
        }
        public void WindowsPhonePushNotificationMessageX509CertificateNullTest()
        {
            var message = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneToastPushNotificationMessage();

            message.AuthenticationSettings = new WindowsPhoneAuthenticationSettings()
            {
                EnableAuthentication = true,
                X509Certificate      = null,
            };

            var result = PushNotifier.SendPushNotificationMessage(message);

            WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, false, false, "0009");
        }
        public void SendAsyncWindowsPhoneCallbackRegistrationRequestTest()
        {
            var returned = false;
            var request  = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneCallbackRegistrationRequest();

            PushNotifier.RegisterCallbackAsync(request, (result) =>
            {
                WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnWindowsPhoneCallbackRegistrationResponse(result, ResultType.Success, true, true);
                returned = true;
            });

            while (!returned)
            {
                System.Threading.Thread.Sleep(500);
            }
        }
        public void SendAsyncWindowsPhoneTilePushNotificationMessageTest()
        {
            var returned = false;
            var message  = WindowsPhonePushNotificationMessageUnitTest.GetValidWindowsPhoneTilePushNotificationMessage();

            PushNotifier.SendPushNotificationMessageAsync(message, (result) =>
            {
                WindowsPhonePushNotificationMessageUnitTest.AssertOperationResultValidationResultsMessageCodeOnPushNotificationSendResult(result, ResultType.Success, true, true);
                returned = true;
            });

            while (!returned)
            {
                System.Threading.Thread.Sleep(500);
            }
        }
        public void Execute(params object[] list)
        {
//			var toastMessage = new MyToast();
//			toastMessage.Text1 = ((string)list[1]);
//			toastMessage.Text2 = ((string)list[2]);
//			toastMessage.NotificationUri = (string)list [0];
//			toastMessage.CreatePayload ();
//			var result = PushNotifier.SendPushNotificationMessage(toastMessage);
            var tileMessage = new MyTile();

            tileMessage.Text1           = ((string)list[1]);
            tileMessage.Text2           = ((string)list[2]);
            tileMessage.NotificationUri = (string)list [0];
            tileMessage.CreatePayload();
            var result2 = PushNotifier.SendPushNotificationMessage(tileMessage);

            //throw new NotImplementedException ();
        }