Example #1
0
        public void Can_fail_sending_player_message_because_player_account_setting(MessageDeliveryMethod messageDeliveryMethod)
        {
            var player = SetUpPlayerMessageTest(messageDeliveryMethod, false);

            MessageTemplateService.TrySendPlayerMessage(
                player.Id,
                MessageType.PlayerRegistered,
                messageDeliveryMethod,
                new PlayerRegisteredModel());

            var events = _eventRepository.GetEvents <NotificationSentEvent>().ToArray();

            Assert.That(events, Is.Empty);
        }
Example #2
0
        public void Can_parse_message()
        {
            var player = SetUpPlayerMessageTest(MessageDeliveryMethod.Sms);

            MessageTemplateService.TrySendPlayerMessage(
                player.Id,
                MessageType.PlayerRegistered,
                MessageDeliveryMethod.Sms,
                new PlayerRegisteredModel());

            var events = _eventRepository.GetEvents <NotificationSentEvent>().ToArray();

            Assert.That(events.Length, Is.EqualTo(1));

            var notificationSentEvent = events.First();

            Assert.That(notificationSentEvent.Message, Contains.Substring(player.Username));
            Assert.That(notificationSentEvent.Status, Is.EqualTo(NotificationStatus.Send));
        }
Example #3
0
        public void Can_send_player_message(MessageDeliveryMethod messageDeliveryMethod)
        {
            var player = SetUpPlayerMessageTest(messageDeliveryMethod);

            MessageTemplateService.TrySendPlayerMessage(
                player.Id,
                MessageType.PlayerRegistered,
                messageDeliveryMethod,
                new PlayerRegisteredModel());

            var events = _eventRepository.GetEvents <NotificationSentEvent>().ToArray();

            Assert.That(events.Length, Is.EqualTo(1));

            var notificationType = messageDeliveryMethod == MessageDeliveryMethod.Email
                ? NotificationType.Email
                : NotificationType.Sms;

            Assert.That(events.First().Type, Is.EqualTo(notificationType));
            Assert.That(events.First().Status, Is.EqualTo(NotificationStatus.Send));
        }