Ejemplo n.º 1
0
 public NotificationBoxController(
     INotificationService notificationService,
     UserNotificationHandler userNotificationHandler)
 {
     _notificationService     = notificationService;
     _userNotificationHandler = userNotificationHandler;
 }
Ejemplo n.º 2
0
        public static void UserNotification(string userid, string message, TimeSpan expiresIn = default(TimeSpan))
        {
            UserNotificationHandler handler = AlertUserNotification;

            if (handler != null)
            {
                handler(userid, message, expiresIn);
            }
        }
        public async Task Should_get_message_with_correct_parameters()
        {
            var subject = new UserNotificationHandler(
                mediator.Object,
                messageFactory.Object);

            var notification = new UserNotification(GameId, UserId);

            await subject.Handle(notification, default);

            messageFactory.Verify(x => x.Create(
                                      It.Is <Messages.GameState.MessageData>(
                                          y => y.GameId == GameId &&
                                          y.PlayerId == UserId)));
        }
        public async Task Should_send_request()
        {
            var subject = new UserNotificationHandler(
                mediator.Object,
                messageFactory.Object);

            var notification = new UserNotification(GameId, UserId);

            await subject.Handle(notification, default);

            mediator.Verify(x => x.Send(
                                It.Is <HubUserNotify.Request>(
                                    y => y.UserId == UserId &&
                                    y.Message == Message),
                                It.IsAny <CancellationToken>()));
        }