Exemplo n.º 1
0
        public void Send(Notification notification, List <string> userIdList)
        {
            #region Contracts

            if (notification == null || notification.IsValid() == false)
            {
                throw new ArgumentException(nameof(notification));
            }
            if (userIdList == null)
            {
                throw new ArgumentException(nameof(notification));
            }

            #endregion

            // Require
            if (userIdList.Count <= 0)
            {
                return;
            }

            // Registration
            var registrationList = _registrationRepository.FindAllByUserId(userIdList);
            if (registrationList == null)
            {
                throw new InvalidOperationException($"{nameof(registrationList)}=null");
            }
            if (registrationList.Count == 0)
            {
                return;
            }

            // Send
            _notificationProvider.Send(notification, registrationList);
        }