public async Task <IActionResult> PushReceiversList(DataSourceRequest command)
        {
            var receivers = await _pushNotificationsService.GetPushReceivers(command.Page - 1, command.PageSize);

            var gridModel = new DataSourceResult();
            var list      = new List <PushRegistrationGridModel>();

            foreach (var receiver in receivers)
            {
                var gridReceiver = new PushRegistrationGridModel();

                var customer = await _customerService.GetCustomerById(receiver.CustomerId);

                if (customer == null)
                {
                    await _pushNotificationsService.DeletePushReceiver(receiver);

                    continue;
                }

                if (!string.IsNullOrEmpty(customer.Email))
                {
                    gridReceiver.CustomerEmail = customer.Email;
                }
                else
                {
                    gridReceiver.CustomerEmail = _translationService.GetResource("Admin.Customers.Guest");
                }

                gridReceiver.CustomerId   = receiver.CustomerId;
                gridReceiver.Id           = receiver.Id;
                gridReceiver.RegisteredOn = _dateTimeService.ConvertToUserTime(receiver.RegisteredOn, DateTimeKind.Utc);
                gridReceiver.Token        = receiver.Token;
                gridReceiver.Allowed      = receiver.Allowed;

                list.Add(gridReceiver);
            }

            gridModel.Data  = list;
            gridModel.Total = receivers.TotalCount;

            return(Json(gridModel));
        }
        public async Task CanGetReceivers()
        {
            ClearPushRegistrations();

            var receiver1 = new PushRegistration {
                Token = "CanGetReceivers1", Allowed = true
            };
            var receiver2 = new PushRegistration {
                Token = "CanGetReceivers2", Allowed = true
            };
            await _pushNotificationsService.InsertPushReceiver(receiver1);

            await _pushNotificationsService.InsertPushReceiver(receiver2);

            var found = await _pushNotificationsService.GetPushReceivers();

            Assert.AreEqual(2, found.Count);
            Assert.AreEqual(true, found.Any(x => x.Token == "CanGetReceivers1"));
            Assert.AreEqual(true, found.Any(x => x.Token == "CanGetReceivers2"));
        }