Ejemplo n.º 1
0
        protected override void validateDbRecords(NotificationData e, NotificationData a)
        {
            var eObj  = NotificationFactory.Create(e);
            var aObj  = NotificationFactory.Create(a);
            var eView = NotificationViewFactory.Create(eObj);
            var aView = NotificationViewFactory.Create(aObj);

            Assert.AreEqual(eView.FormattedMessage, aView.FormattedMessage);
            base.validateDbRecords(e, a);
        }
Ejemplo n.º 2
0
        public void CreateTest()
        {
            void test <T>(NotificationData r)
            {
                var o = NotificationFactory.Create(r);

                Assert.IsInstanceOfType(o, typeof(T));
            }

            test <NewInsuranceNotification>(GetRandom.Object <NewInsuranceNotificationData>());
            test <NewRequestTransactionNotification>(GetRandom.Object <NewRequestTransactionNotificationData>());
            test <NewTransactionNotification>(GetRandom.Object <NewTransactionNotificationData>());
            test <RequestStatusNotification>(GetRandom.Object <RequestStatusNotificationData>());
            test <WelcomeNotification>(GetRandom.Object <NotificationData>());
            test <WelcomeNotification>(GetRandom.Object <WelcomeNotificationData>());
            test <WelcomeNotification>(null);
        }
Ejemplo n.º 3
0
        public async Task StartAsync(WorkerDto downTimeAppDto, CancellationToken cancellationToken)
        {
            downTimeAppDto.Timer.Elapsed += async(sender, args) =>
            {
                if (!cancellationToken.IsCancellationRequested)
                {
                    var status = await _urlStatusChecker.CheckUrlAsync(downTimeAppDto.Url);

                    if (!status)
                    {
                        await _notificationFactory
                        .Create((NotificationType)downTimeAppDto.NotificationType, downTimeAppDto.Email)
                        .SendAsync();
                    }
                }
            };
            downTimeAppDto.Timer.Start();
            await Task.CompletedTask;
        }
Ejemplo n.º 4
0
 protected override INotification createObject(NotificationData r) => NotificationFactory.Create(r);
Ejemplo n.º 5
0
 /// <summary>
 /// Refreshes as specified by a json payload.
 /// </summary>
 /// <param name="json">The json payload.</param>
 public virtual void Refresh(string json)
 {
     OnCacheUpdated(NotificationFactory.Create <TNotification>(json, MessageType.RefreshByJson));
 }
        public async Task <INotification> GetObject(string id)
        {
            var r = await getObject(id);

            return(NotificationFactory.Create(r));
        }
 /// <summary>
 ///     Refreshes as specified by a payload.
 /// </summary>
 /// <param name="payloads">The payload.</param>
 public virtual void Refresh(TPayload[] payloads) =>
 OnCacheUpdated(NotificationFactory.Create <TNotification>(payloads, MessageType.RefreshByPayload));