コード例 #1
0
        public void GetWebNotifications_NotificationsInDb_Enumeration(int a)
        {
            mockUnitOfWork.Setup(m => m.Notifications.Get(It.IsAny <Expression <Func <Notification, bool> > >()
                                                          , It.IsAny <Func <IQueryable <Notification>,
                                                                            IOrderedQueryable <Notification> > >(), It.IsAny <string>()))
            .Returns(new List <Notification> {
                new Notification {
                    Time = DateTime.Now, Type = NotificationType.Web
                },
                new Notification {
                    Time = DateTime.Now, Type = NotificationType.Web
                },
                new Notification {
                    Time = DateTime.Now, Type = NotificationType.Web
                },
                new Notification {
                    Time = DateTime.Now, Type = NotificationType.Web
                },
                new Notification {
                    Time = DateTime.MinValue, Type = NotificationType.Web
                },
                new Notification {
                    Time = DateTime.Now, Type = NotificationType.Web
                },
                new Notification {
                    Time = DateTime.Now, Type = NotificationType.Web
                },
                new Notification {
                    Time = DateTime.MaxValue, Type = NotificationType.Web
                },
            });
            mockMapper.Setup(m => m.Map <IEnumerable <Notification>
                                         , IEnumerable <WebNotificationDTO> >(It.IsAny <IEnumerable <Notification> >()))
            .Returns(new List <WebNotificationDTO> {
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO()
            });

            var result = handler.GetWebNotifications("Hello", a);

            Assert.That(result.Count() > 0);
        }
コード例 #2
0
        public void GetWebNotifications_NotificationsInDb_Enumeration(int a)
        {
            mockUnitOfWork.Setup(m => m.EmailCampaignNotifications.Get(It.IsAny <Expression <Func <EmailCampaignNotification, bool> > >()
                                                                       , It.IsAny <Func <IQueryable <EmailCampaignNotification>,
                                                                                         IOrderedQueryable <EmailCampaignNotification> > >(), It.IsAny <string>()))
            .Returns(new List <EmailCampaignNotification> {
                new EmailCampaignNotification {
                    Type            = NotificationType.Web
                    , EmailCampaign = new EmailCampaign {
                        SendingTime = DateTime.Now
                    }
                },
                new EmailCampaignNotification {
                    Type            = NotificationType.Web
                    , EmailCampaign = new EmailCampaign {
                        SendingTime = DateTime.Now
                    }
                },
                new EmailCampaignNotification {
                    Type            = NotificationType.Web
                    , EmailCampaign = new EmailCampaign {
                        SendingTime = DateTime.Now
                    }
                },
                new EmailCampaignNotification {
                    Type            = NotificationType.Web
                    , EmailCampaign = new EmailCampaign {
                        SendingTime = DateTime.Now
                    }
                },
                new EmailCampaignNotification {
                    Type            = NotificationType.Web
                    , EmailCampaign = new EmailCampaign {
                        SendingTime = DateTime.Now
                    }
                },
                new EmailCampaignNotification {
                    Type            = NotificationType.Web
                    , EmailCampaign = new EmailCampaign {
                        SendingTime = DateTime.Now
                    }
                },
                new EmailCampaignNotification {
                    Type            = NotificationType.Web
                    , EmailCampaign = new EmailCampaign {
                        SendingTime = DateTime.Now
                    }
                },
                new EmailCampaignNotification {
                    Type            = NotificationType.Web
                    , EmailCampaign = new EmailCampaign {
                        SendingTime = DateTime.Now
                    }
                },
            });
            mockMapper.Setup(m => m.Map <IEnumerable <EmailCampaignNotification>
                                         , IEnumerable <WebNotificationDTO> >(It.IsAny <IEnumerable <EmailCampaignNotification> >()))
            .Returns(new List <WebNotificationDTO> {
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO(),
                new WebNotificationDTO()
            });

            mockBaseHandler.Setup(m => m.GetWebNotifications(It.IsAny <string>(), It.IsAny <int>()))
            .Returns(new List <WebNotificationDTO>());

            var result = handler.GetWebNotifications("Hello", a);

            Assert.That(result.Count() > 0);
        }
コード例 #3
0
        /// <summary>
        /// Generate list of sent notifications in descending order for User with userId
        /// </summary>
        /// <param name="userId">Identity User Id</param>
        /// <param name="number">Quantity of returned notifications</param>
        /// <returns>Enumeration of notifications in descending (by time) order</returns>
        public IEnumerable <WebNotificationDTO> GetWebNotificationsPage(string userId, int number)
        {
            var result = handler.GetWebNotifications(userId, number);

            return(result);
        }