Exemple #1
0
        private void ConfigureTracking(UserNotification notification, string language, UserEventMessage userEvent)
        {
            var confirmMode = userEvent.Formatting.ConfirmMode;

            if (confirmMode == ConfirmMode.Explicit)
            {
                notification.ConfirmUrl = url.TrackConfirmed(notification.Id, language);

                if (string.IsNullOrWhiteSpace(notification.Formatting.ConfirmText))
                {
                    notification.Formatting.ConfirmText = DefaultConfirmText;
                }
            }

            notification.TrackingUrl = url.TrackSeen(notification.Id, language);
        }
        public UserNotificationFactoryTests()
        {
            app = new App
            {
                Languages = new string[]
                {
                    "en",
                    "de"
                }
            };

            A.CallTo(() => clock.GetCurrentInstant())
            .Returns(now);

            A.CallTo(() => notificationUrl.TrackConfirmed(A <Guid> ._, A <string> ._))
            .ReturnsLazily(new Func <Guid, string, string>((id, lang) => $"confirm/{id}/?lang={lang}"));

            A.CallTo(() => notificationUrl.TrackSeen(A <Guid> ._, A <string> ._))
            .ReturnsLazily(new Func <Guid, string, string>((id, lang) => $"seen/{id}/?lang={lang}"));

            sut = new UserNotificationFactory(clock, logStore, notificationUrl);
        }