Example #1
0
 public void AddNewCategory()
 {
     UnitOfWork uow = new UnitOfWork();
     Category NewCat = new Category();
     NewCat.Title = "Assorted";
     NewCat.Description = "A bunch of assorted articles.";
     uow.CategoryRepository.Insert(NewCat);
     uow.Save();
 }
Example #2
0
 public void AddNewComment()
 {
     UnitOfWork uow = new UnitOfWork();
     Comment newComment = new Comment();
     newComment.ItemForSale = uow.ItemForSaleRepository.GetByID(0);
     newComment.PosterUser = uow.UserRepository.GetByID(1);
     newComment.Content = "Hello ladies.";
     uow.CommentRepository.Insert(newComment);
     uow.Save();
 }
Example #3
0
        public void AddNewItemForSale2()
        {
            UnitOfWork uow = new UnitOfWork();

            // Let's suppose we're selling a chair
            ItemForSale Chair = new ItemForSale();
            Chair.Seller = uow.UserRepository.GetByID(1);
            Chair.Description = "A cool chair, this time made out of iron.";
            Chair.Title = "The Iron Throne";
            Chair.Price = 40;
            uow.ItemForSaleRepository.Insert(Chair);
            uow.Save();
        }
Example #4
0
 public void AddNewUserJens()
 {
     UnitOfWork uow = new UnitOfWork();
     User user = new User();
     user.NickName = "jensdewulf";
     Person person = new Person();
     person.FirstName = "Jens";
     person.LastName = "De Wulf";
     person.Type = "Administrator";
     user.Person = person;
     user.Email = "*****@*****.**";
     uow.UserRepository.Insert(user);
     uow.Save();
 }
Example #5
0
 public void AddNewLocation()
 {
     UnitOfWork uow = new UnitOfWork();
     Location CampusGDM = new Location();
     CampusGDM.Latitude = "";
     CampusGDM.Longitude = "";
     CampusGDM.Title = "Campus GDM";
     uow.LocationRepository.Insert(CampusGDM);
     uow.Save();
 }
Example #6
0
 public void LikeAndCategorizeSomething()
 {
     UnitOfWork uow = new UnitOfWork();
     ItemForSale ChairILike = uow.ItemForSaleRepository.GetByID(1);
     Category Cat = uow.CategoryRepository.GetByID(1);
     ChairILike.Categories.Add(Cat);
     User Me = uow.UserRepository.GetByID(1);
     ChairILike.Likes.Add(Me);
     uow.ItemForSaleRepository.Update(ChairILike);
     uow.Save();
 }
Example #7
0
        public void AddRandomMember()
        {
            // Generate random characters
            var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

            // First name random generation
            var random = new Random();
            var firstrandom = new string(
                Enumerable.Repeat(chars, 8)
                          .Select(s => s[random.Next(s.Length)])
                          .ToArray());

            // Second name random generation
            var random2 = new Random();
            var secondrandom = new string(
                Enumerable.Repeat(chars, 8)
                          .Select(s => s[random2.Next(s.Length)])
                          .ToArray());

            // Add new character
            UnitOfWork uow = new UnitOfWork();

            // Create new member
            Member member = new Member();
            User user = new User();

            // Create new person
            Person person = new Person();
            person.FirstName = firstrandom.ToString();
            person.LastName = secondrandom.ToString();
            person.Type = "Administrator";

            // Set member nickname, email, password & salt
            member.NickName = firstrandom.ToString();
            member.Email = firstrandom + "." + secondrandom + "@gmail.com";
            member.Password = "******";
            member.Salt = "";
            member.ConfirmationToken = "ABC";

            // Assign new person to member (foreign keys)
            member.Person = person;

            uow.MemberRepository.Insert(member);
            uow.Save();
        }
Example #8
0
 public void AddNewWishlist()
 {
     UnitOfWork uow = new UnitOfWork();
     Wishlist newlist = new Wishlist();
     newlist.User = uow.UserRepository.GetByID(1);
     newlist.Description = "A cool list with stuff I want.";
     uow.WishlistRepository.Insert(newlist);
     uow.Save();
 }
Example #9
0
 public void AddNewUserNico()
 {
     UnitOfWork uow = new UnitOfWork();
     User user = new User();
     user.NickName = "nicoverbruggen";
     Person person = new Person();
     person.FirstName = "Nico";
     person.LastName = "Verbruggen";
     person.Type = "Administrator";
     user.Person = person;
     user.Email = "*****@*****.**";
     uow.UserRepository.Insert(user);
     uow.Save();
 }