public void Build_HrefGenerated_NotificationsContainsHrefs()
        {
            ApplicationUser user = new ApplicationUser
            {
                Id                        = "GreatHuman",
                PhoneNumber               = "+380566754454",
                PhoneNumberConfirmed      = true,
                SmsNotificationsEnabled   = true,
                Email                     = "*****@*****.**",
                EmailConfirmed            = true,
                EmailNotificationsEnabled = true
            };
            var    mockUrlHelper = new Mock <IUrlHelper>();
            string href          = "https://4chan.org/";
            string action        = "Hello";
            string controller    = "Heaven";
            object values        = new { Devil = "!God" };

            mockUrlHelper.Setup(x => x.Action(It.IsAny <UrlActionContext>())).Returns(href);

            var result = new PersonalNotificationBuilder(user)
                         .GenerateHref(mockUrlHelper.Object, action, controller, values).Build();

            Assert.That(result.All(x => x.Href == href));
        }
        public void Build_UserHasEmailAndSmsNotificationsAllowed_CollectionWithoutEmailAndSmsNotification()
        {
            ApplicationUser user = new ApplicationUser
            {
                Id                        = "GreatHuman",
                PhoneNumber               = "+380566754454",
                PhoneNumberConfirmed      = true,
                SmsNotificationsEnabled   = true,
                Email                     = "*****@*****.**",
                EmailConfirmed            = true,
                EmailNotificationsEnabled = true
            };

            var result = new PersonalNotificationBuilder(user).Build();

            Assert.That(result.Any(x => x.Type == NotificationType.Email) && result.Any(x => x.Type == NotificationType.Email));
        }
        public void Build_TimeSpecified_NotificationsContainsTime()
        {
            ApplicationUser user = new ApplicationUser
            {
                Id                        = "GreatHuman",
                PhoneNumber               = "+380566754454",
                PhoneNumberConfirmed      = true,
                SmsNotificationsEnabled   = true,
                Email                     = "*****@*****.**",
                EmailConfirmed            = true,
                EmailNotificationsEnabled = true
            };

            var result = new PersonalNotificationBuilder(user)
                         .SetTime(DateTime.MaxValue).Build();

            Assert.That(result.All(x => x.Time == DateTime.MaxValue));
        }
        public void Build_HrefSet_NotificationsContainsHrefs()
        {
            ApplicationUser user = new ApplicationUser
            {
                Id                        = "GreatHuman",
                PhoneNumber               = "+380566754454",
                PhoneNumberConfirmed      = true,
                SmsNotificationsEnabled   = true,
                Email                     = "*****@*****.**",
                EmailConfirmed            = true,
                EmailNotificationsEnabled = true
            };
            string href = "https://4chan.org/";

            var result = new PersonalNotificationBuilder(user)
                         .SetHref(href).Build();

            Assert.That(result.All(x => x.Href == href));
        }
        public void Build_TitleAndMessageSpecified_NotificationsContainsTitlesAndMessages()
        {
            ApplicationUser user = new ApplicationUser
            {
                Id                        = "GreatHuman",
                PhoneNumber               = "+380566754454",
                PhoneNumberConfirmed      = true,
                SmsNotificationsEnabled   = true,
                Email                     = "*****@*****.**",
                EmailConfirmed            = true,
                EmailNotificationsEnabled = true
            };
            string title   = "Emperor Protects!";
            string message = "For the Emperor!";

            var result = new PersonalNotificationBuilder(user)
                         .SetMessage(title, message).Build();

            Assert.That(result.All(x => x.Message == message && x.Title == title));
        }