private Mock<ApplicationDbContext> GetApplicationDbContextMock()
        {
            // single user
            var appUser = new ApplicationUser();
            appUser.Id = "1";

            var data = new List<ToDo>  {
                    new ToDo { Id = 0, Title = "Todo 1", Completed = false, User = appUser },
                    new ToDo { Id = 1, Title = "Todo 2", Completed = true, User = appUser },
                  }.AsQueryable();

            var mockSet = new Mock<DbSet<ToDo>>();

            mockSet.As<IDbAsyncEnumerable<ToDo>>()
               .Setup(m => m.GetAsyncEnumerator())
               .Returns(new TestDbAsyncEnumerator<ToDo>(data.GetEnumerator()));

            mockSet.As<IQueryable<ToDo>>()
                .Setup(m => m.Provider)
                .Returns(new TestDbAsyncQueryProvider<ToDo>(data.Provider));

            mockSet.As<IQueryable<ToDo>>().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As<IQueryable<ToDo>>().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As<IQueryable<ToDo>>().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            var applicationDbContext = new Mock<ApplicationDbContext>();
            applicationDbContext.Setup(c => c.ToDos).Returns(mockSet.Object);

            return applicationDbContext;
        }
        protected override void Seed(Quản_Lý_Coffee.Models.QuanLyCoffeeDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.
            var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new QuanLyCoffeeDbContext()));

            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new QuanLyCoffeeDbContext()));

            var user = new Models.ApplicationUser()
            {
                UserName       = "******",
                Email          = "*****@*****.**",
                EmailConfirmed = true,
            };

            manager.Create(user, "Hieu1122");

            var user1 = new Models.ApplicationUser()
            {
                UserName       = "******",
                Email          = "*****@*****.**",
                EmailConfirmed = true,
            };

            manager.Create(user1, "Hieu1122");

            if (roleManager.Roles.Count() == 0)
            {
                roleManager.Create(new IdentityRole {
                    Name = "Admin"
                });
                roleManager.Create(new IdentityRole {
                    Name = "Mod"
                });
                roleManager.Create(new IdentityRole {
                    Name = "User"
                });
            }

            var adminUser = manager.FindByName("Admin_Manager");

            manager.AddToRoles(adminUser.Id, new string[] { "Mod", "Admin" });

            var adminUser1 = manager.FindByName("XuanHieu");

            manager.AddToRoles(adminUser.Id, new string[] { "Mod" });
        }
Пример #3
0
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
            var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
            var user = new ApplicationUser() { UserName = Username.Text, Email = Email.Text };
            IdentityResult result = manager.Create(user, Password.Text);
            if (result.Succeeded)
            {
                // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                //string code = manager.GenerateEmailConfirmationToken(user.Id);
                //string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request);
                //manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>.");

                signInManager.SignIn( user, isPersistent: false, rememberBrowser: false);
                IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
            }
            else 
            {
                ErrorMessage.Text = result.Errors.FirstOrDefault();
            }
        }
Пример #4
0
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                using(var db= new ELearningContext())
                {
                    User userr= new User(){UserName=model.UserName, Password= model.Password};
                    db.Users.Add(userr);
                    db.SaveChanges();
                }
                var user = new ApplicationUser() { UserName = model.UserName };
                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    await SignInAsync(user, isPersistent: false);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    AddErrors(result);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Пример #5
0
 private async Task SignInAsync(ApplicationUser user, bool isPersistent)
 {
     AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
     var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
     AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
 }
        private void CreateAndLoginUser()
        {
            if (!IsValid)
            {
                return;
            }
            var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
            var signInManager = Context.GetOwinContext().GetUserManager<ApplicationSignInManager>();
            var user = new ApplicationUser() { UserName = email.Text, Email = email.Text };
            IdentityResult result = manager.Create(user);
            if (result.Succeeded)
            {
                var loginInfo = Context.GetOwinContext().Authentication.GetExternalLoginInfo();
                if (loginInfo == null)
                {
                    RedirectOnFail();
                    return;
                }
                result = manager.AddLogin(user.Id, loginInfo.Login);
                if (result.Succeeded)
                {
                    signInManager.SignIn(user, isPersistent: false, rememberBrowser: false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // var code = manager.GenerateEmailConfirmationToken(user.Id);
                    // Send this link via email: IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id)

                    IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
                    return;
                }
            }
            AddErrors(result);
        }
Пример #7
0
        private void SetupFakeAds()
        {
            var adTypes = new List<AdType>
            {
                new AdType()
                {
                    Name = "Normal",
                    PricePerDay = 3.99m,
                    Index = 100
                },
                new AdType()
                {
                    Name = "Premium",
                    PricePerDay = 5.99m,
                    Index = 200
                },
                new AdType()
                {
                    Name = "Diamond",
                    PricePerDay = 9.99m,
                    Index = 300
                }
            };

            var user = new ApplicationUser()
            {
                UserName = "******",
                Id = "asd"
            };

            var fakeAds = new List<Ad>()
            {
                new Ad()
                {
                    Id = 1,
                    Name = "asd",
                    Description = "asd",
                    Status = AdStatus.Open,
                    Price = 3.55M,
                    PostedOn = DateTime.Now.AddDays(-5),
                    Owner = user,
                    Type = adTypes[0]
                },
                new Ad()
                {
                    Id = 2,
                    Name = "asf",
                    Description = "asf",
                    Status = AdStatus.Closed,
                    Price = 16.98M,
                    PostedOn = DateTime.Now.AddDays(-22),
                    Owner = user,
                    Type = adTypes[1]
                },
                new Ad()
                {
                    Id = 3,
                    Name = "asda",
                    Description = "asda",
                    Status = AdStatus.Open,
                    Price = 12.22M,
                    PostedOn = DateTime.Now,
                    Owner = user,
                    Type = adTypes[2]
                }
            };

            this.AdRepositoryMock = new Mock<IRepository<Ad>>();
            this.AdRepositoryMock
                .Setup(r => r.All())
                .Returns(fakeAds.AsQueryable());
            this.AdRepositoryMock
                .Setup(r => r.Find(It.IsAny<int>()))
                .Returns((int id) =>
                {
                    return fakeAds.FirstOrDefault(a => a.Id == id);
                });
        }
        internal static void SeedUsers(EntertainmentSystemDbContext context)
        {
            if (context.Users.Any())
            {
                return;
            }

            const string AdministratorUserName = "******";
            const string AdministratorFirstName = "Admincho";
            const string AdministratorLastName = "Adminov";
            const string AdministratorPassword = "******";
            const string AdministratorImageUrl = "http://vignette4.wikia.nocookie.net/marveldatabase/images/4/41/Boreas_0001.jpg/revision/latest?cb=20110201173602";

            const string ModeratorUserName = "******";
            const string ModeratorFirstName = "Gosho";
            const string ModeratorLastName = "Peshev";
            const string ModeratorPassword = "******";
            const string ModeratorImageUrl = "http://batman-news.com/wp-content/uploads/2014/01/logo-snb.png";

            // Create admin user
            var userStore = new UserStore<ApplicationUser>(context);
            var userManager = new UserManager<ApplicationUser>(userStore);
            userManager.PasswordValidator = new MinimumLengthValidator(GlobalConstants.PasswordMinLength);

            var userAdmin = new ApplicationUser
            {
                UserName = AdministratorUserName,
                Email = AdministratorUserName,
                FirstName = AdministratorFirstName,
                LastName = AdministratorLastName,
                AvatarImageUrl = AdministratorImageUrl
            };

            userManager.Create(userAdmin, AdministratorPassword);

            // Assign user to admin role
            userManager.AddToRole(userAdmin.Id, GlobalConstants.AdministratorRoleName);

            // Create moderator user
            var userModerator = new ApplicationUser
            {
                UserName = ModeratorUserName,
                Email = ModeratorUserName,
                FirstName = ModeratorFirstName,
                LastName = ModeratorLastName,
                AvatarImageUrl = ModeratorImageUrl
            };

            userManager.Create(userModerator, ModeratorPassword);

            // Assign user to moderator role
            userManager.AddToRole(userModerator.Id, GlobalConstants.ModeratorRoleName);

            // Create ordinary user
            var userOrdinary = new ApplicationUser
            {
                UserName = "******",
                Email = "*****@*****.**",
                FirstName = "FirstName",
                LastName = "LastName",
                AvatarImageUrl = "https://upload.wikimedia.org/wikipedia/en/e/eb/SupermanRoss.png"
            };

            userManager.Create(userOrdinary, "TestUser");

            // End add.
            context.SaveChanges();
        }
Пример #9
0
        public SeedData(ApplicationUser author)
        {
            this.Categories = new List<Category>();
            Categories.Add(new Category() { Name = "Laptop" });
            Categories.Add(new Category() { Name = "Monitor" });
            Categories.Add(new Category() { Name = "Phones" });
            Categories.Add(new Category() { Name = "Cameras" });
            Categories.Add(new Category() { Name = "Watches" });
            Categories.Add(new Category() { Name = "TVs" });
            Categories.Add(new Category() { Name = "Coolers" });

            this.Author = author;
            ApplicationUser user = author;

            this.Items = new List<Item>();
            Items.Add(new Item()
            {
                Category = Categories[0],
                Title = "Asus",

                Description = "Super cool",
                Pieces = 10,
                Price = 700.00,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5))
            });
            Items.Add(new Item()
            {
                Category = Categories[2],
                Title = "Samsung",

                Description = "Super cool",
                Pieces = 5,
                Price = 300.00,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5))
            });
            Items.Add(new Item()
            {
                Category = Categories[2],
                Title = "Phil",

                Description = "Super cool",
                Pieces = 2,
                Price = 1200.00,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5))
            });
            Items.Add(new Item()
            {
                Category = Categories[4],
                Title = "Swatch",

                Description = "Super cool",
                Pieces = 7,
                Price = 200.00,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5))
            });
            Items.Add(new Item()
            {
                Category = Categories[6],
                Title = "Ice Cool",

                Description = "Super cool",
                Pieces = 22,
                Price = 56.00,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5))
            });
            Items.Add(new Item()
            {
                Category = Categories[3],
                Title = "Simens",

                Description = "Super cool",
                Pieces = 22,
                Price = 500.00,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5))
            });
            Items.Add(new Item()
            {
                Category = Categories[5],
                Title = "Asus",

                Description = "Super cool",
                Pieces = 12,
                Price = 700.00,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5))
            });
        }
        public async Task<IHttpActionResult> RegisterExternal(RegisterExternalBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var info = await Authentication.GetExternalLoginInfoAsync();
            if (info == null)
            {
                return InternalServerError();
            }

            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };

            IdentityResult result = await UserManager.CreateAsync(user);
            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }

            result = await UserManager.AddLoginAsync(user.Id, info.Login);
            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }
            return Ok();
        }
        public async Task<IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }

            return Ok();
        }
Пример #12
0
 private async Task SignInAsync(ApplicationUser user, bool isPersistent)
 {
     AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
     AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, await user.GenerateUserIdentityAsync(UserManager));
 }
Пример #13
0
        public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
        {
            if (User.Identity.IsAuthenticated)
            {
                return RedirectToAction("Manage");
            }

            if (ModelState.IsValid)
            {
                // Get the information about the user from the external login provider
                var info = await AuthenticationManager.GetExternalLoginInfoAsync();
                if (info == null)
                {
                    return View("ExternalLoginFailure");
                }
                var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user);
                if (result.Succeeded)
                {
                    result = await UserManager.AddLoginAsync(user.Id, info.Login);
                    if (result.Succeeded)
                    {
                        // Add the user to the registration table like normal account
                        // Create the profile for the user
                        // But no need to create the billing and shipping details
                        var userProfile = UserProfile.Create(model.Email, string.Empty, model.Email,
                            model.NewsletterSubscription, Request.UserHostAddress);

                        _profileService.CreateUser(userProfile);

                        await SignInAsync(user, isPersistent: false);

                        // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                        // Send an email with this link
                        // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                        // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                        // SendEmail(user.Email, callbackUrl, "Confirm your account", "Please confirm your account by clicking this link");

                        return RedirectToLocal(returnUrl);
                    }
                }
                AddErrors(result);
            }

            ViewBag.ReturnUrl = returnUrl;
            return View(model);
        }
Пример #14
0
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.ContainsKey("CaptchaInputText"))
            {
                model.IsCaptchaNotValid = true;
            }

            if (ModelState.IsValid)
            {
                var user = new ApplicationUser
                {
                    UserName = model.Email,
                    Email = model.Email,
                    NewsletterSubscription = model.NewsletterSubscription,
                    EmailConfirmed = true // No two-factory auth here :)
                };

                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {

                    try
                    {
                        // Create the profile for the user
                        // But no need to create the billing and shipping details
                        var userProfile = UserProfile.Create(model.Email, model.Password, model.Email,
                            model.NewsletterSubscription, Request.UserHostAddress);

                        _profileService.CreateUser(userProfile);
                    }
                    catch (Exception)
                    {
                        UserManager.Delete(user); // Delete the user so that we don't end up with bad data
                        throw;
                    }

                    // Add the user to the context if available
                    _cartContext.SetUser(model.Email);

                    await SignInAsync(user, isPersistent: false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    if (_cartContext.HasItemsInCart())
                    {
                        return RedirectToAction("Checkout", "Cart");
                    }

                    return RedirectToAction("Details", "Account");
                }
                else
                {
                    AddErrors(result);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser { UserName = model.Username, Email = model.Email };
                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
                    
                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return RedirectToAction("Index", "Home");
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
        {
            if (User.Identity.IsAuthenticated)
            {
                return RedirectToAction("Index", "Manage");
            }

            if (ModelState.IsValid)
            {
                // Get the information about the user from the external login provider
                var info = await AuthenticationManager.GetExternalLoginInfoAsync();
                if (info == null)
                {
                    return View("ExternalLoginFailure");
                }
                var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user);
                if (result.Succeeded)
                {
                    result = await UserManager.AddLoginAsync(user.Id, info.Login);
                    if (result.Succeeded)
                    {
                        await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                        return RedirectToLocal(returnUrl);
                    }
                }
                AddErrors(result);
            }

            ViewBag.ReturnUrl = returnUrl;
            return View(model);
        }
Пример #17
0
        public SeedData()
        {
            this.Categories = new List<Category>();
            Categories.Add(new Category() { Name = "Art" });
            Categories.Add(new Category() { Name = "Economy" });
            Categories.Add(new Category() { Name = "Technology" });
            Categories.Add(new Category() { Name = "Education" });
            Categories.Add(new Category() { Name = "Sports" });
            Categories.Add(new Category() { Name = "Science" });
            Categories.Add(new Category() { Name = "Weather" });

            ApplicationUser user = new ApplicationUser() { UserName = "******", Email = "*****@*****.**" };

            this.User = user;

            this.Articles = new List<Article>();
            Articles.Add(new Article()
            {
                Category = Categories[1],
                Title = "What is Lorem Ipsum?",
                Content = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&amp;amp;amp;#39;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
                Author = user,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5)),
                Likes = 3
            });
            Articles.Add(new Article()
            {
                Category = Categories[1],
                Title = "Why do we use it?",
                Content = "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using &amp;amp;amp;#39;Content here, content here&amp;amp;amp;#39;, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for &amp;amp;amp;#39;lorem ipsum&amp;amp;amp;#39; will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).",
                Author = user,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5)),
                Likes = 2
        });
            Articles.Add(new Article()
            {
                Category = Categories[3],
                Title = "Where does it come from?",
                Content = "Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of &amp;amp;amp;quot;de Finibus Bonorum et Malorum&amp;amp;amp;quot; (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, &amp;amp;amp;quot;Lorem ipsum dolor sit amet..&amp;amp;amp;quot;, comes from a line in section 1.10.32.",
                Author = user,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5)),
                Likes = 0
            });
            Articles.Add(new Article()
            {
                Category = Categories[4],
                Title = "Where can I get some more?",
                Content = "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don&amp;amp;amp;#39;t look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn&amp;amp;amp;#39;t anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.",
                Author = user,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5)),
                Likes = 5
            });
            Articles.Add(new Article()
            {
                Category = Categories[3],
                Title = "Where can I get some?",
                Content = "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don&#39;t look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn&#39;t anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.",
                Author = user,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5)),
                Likes = 3
            });
            Articles.Add(new Article()
            {
                Category = Categories[5],
                Title = "de Finibus Bonorum et Malorum",
                Content = "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
                Author = user,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5)),
                Likes = 1
            });
            Articles.Add(new Article()
            {
                Category = Categories[5],
                Title = "1914 translation by H. Rackham",
                Content = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?",
                Author = user,
                DateCreated = DateTime.Now.AddDays(Rand.Next(-5, 5)),
                Likes = 6
            });
        }