Exemplo n.º 1
0
 public void LookupBasedOnAge()
 {
     User usr = new User(null, new Name(null,null));
     usr.DateOfBirth = new GetInDate(DateTime.Today.AddYears(-25));
     IList<User> results = usrRep.LookupUsers(usr, new AgeRange{From = 20, To = 29});
     Assert.AreEqual(3, results.Count);
 }
Exemplo n.º 2
0
        public void UserCanPostToSubscribedGroup()
        {
            //            Mock<Group> mockGroup = new Mock<Group>();
            Post post = new Post() {Content = "Some stupid content", PostedDateTime = new DateTime(2010, 01, 01)};

            //            Group group = mockGroup.Object;
            Group group = new Group("test");

            //            mockGroup.Setup(foo => foo.post(post));
            //            mockGroup.Setup(foo => foo.Equals(It.IsAny<Group>())).Returns(true);

            LoginId loginid = new LoginId("*****@*****.**");
            string firstname = "firstName";
            string lastname = "lastName";
            Name name = new Name(firstname, lastname);

            User footballFan = new User(loginid, name);

            footballFan.Groups.Add(group);

            try
            {
                footballFan.PostToGroup(group, post);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed");
            }
        }
Exemplo n.º 3
0
 public void LookupBasedOnGender()
 {
     User usr1 = new User(null, new Name(null, null));
     usr1.Gender = new Gender('F');
     IList<User> results = usrRep.LookupUsers(usr1);
     Assert.AreEqual(1,results.Count);
 }
Exemplo n.º 4
0
        public void DegreeOfSeparationShouldBeMinimumOfTwoPathsForTheSameFriend()
        {
            IUserRepository repository = new UserRepository(session);

            var loginid = new LoginId("*****@*****.**");
            var name = new Name("Suchit", "Puri");
            var suchit = new User(loginid, name) { Repository = repository };

            var loginid2 = new LoginId("*****@*****.**");
            var name2 = new Name("Sumit", "Gupta");
            var sumit = new User(loginid2, name2) { Repository = repository };

            var loginid3 = new LoginId("*****@*****.**");
            var name3 = new Name("Manav", "Prasad");
            var manav = new User(loginid3, name3) { Repository = repository };

            repository.Save(sumit);
            repository.Save(suchit);
            repository.Save(manav);

            suchit.InviteFriend(sumit);
            sumit.AcceptFriendInvite(suchit);
            sumit.InviteFriend(manav);
            manav.AcceptFriendInvite(sumit);

            suchit.InviteFriend(manav);
            manav.AcceptFriendInvite(suchit);

            session.Flush();
            session.Evict(suchit);
            session.Evict(sumit);
            session.Evict(manav);
            Assert.AreEqual(1, suchit.DegreeOfSeparation(manav).Count);
        }
Exemplo n.º 5
0
 public void LookupBasedOnProfile()
 {
     User usr = new User(null, new Name(null, null));
     usr.Profile = new Profile("crap");
     IList<User> results = usrRep.LookupUsers(usr);
     Assert.AreEqual(3, results.Count);
 }
Exemplo n.º 6
0
 public void ShouldBeAbleToGetTheLatestComment()
 {
     var user1 = new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1"));
     user1.AddCommentToProfile(new Comment(user1,user1,"This is the first comment",new GetInDate(new DateTime(2010,01,01))));
     user1.AddCommentToProfile(new Comment(user1,user1,"This is the second comment",new GetInDate(new DateTime(2010,02,03))));
     user1.AddCommentToProfile(new Comment(user1,user1,"This is the third comment",new GetInDate(new DateTime(2010,01,02))));
     Assert.AreEqual("This is the second comment",user1.GetLatestProfileComment().Content);
 }
Exemplo n.º 7
0
 public Comment(User commentor, User commentedOn, String content)
 {
     Commentor = commentor;
     CommentedOn = commentedOn;
     Content = content;
     CommentedOn.AddCommentToProfile(this);
     CommentDate = new GetInDate(DateTime.Now);
 }
Exemplo n.º 8
0
 public Comment(User commentor, User commentedOn, String content, GetInDate myDate)
 {
     Commentor = commentor;
     CommentedOn = commentedOn;
     Content = content;
     CommentedOn.AddCommentToProfile(this);
     CommentDate = myDate;
 }
Exemplo n.º 9
0
 public IList<User> NotFriendsOf(User user)
 {
     ICriteria lookupCriteria = Session.CreateCriteria(typeof(User));
     var exclusionList = ExtractUserIds(user.Friends);
     exclusionList.Add(user.Id);
     lookupCriteria.Add(Restrictions.Not(Restrictions.In("Id", exclusionList)));
     return lookupCriteria.List<User>();
 }
Exemplo n.º 10
0
 public void LookupBasedOnAgeAndName()
 {
     User usr = new User(null, new Name(null, null));
     usr.DateOfBirth = new GetInDate(DateTime.Today.AddYears(-25));
     usr.Name = new Name{FirstName = "Alex"};
     IList<User> results = usrRep.LookupUsers(usr);
     Assert.AreEqual(1, results.Count);
 }
Exemplo n.º 11
0
 public void UserShouldBeAbleToCommentOnAProfile()
 {
     var user1 = new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1"));
     var user2 = new User(new LoginId("*****@*****.**"), new Name("firstName2", "lastName2")) { Profile = new Profile("This is the profile on which user1 will comment") };
     var comment = new Comment(user1, user2, "This is what I am going to comment");
     Assert.AreEqual(comment.Commentor, user1);
     Assert.AreEqual(comment.CommentedOn, user2);
     Assert.AreEqual(comment, user2.GetLatestProfileComment());
 }
Exemplo n.º 12
0
 public IList<User> LookupUsers(User user, AgeRange ageRange)
 {
     var lookupCriteria = BuildLookupCriteria(user);
     if(ageRange != null){
         var beginDate = new GetInDate(DateTime.Now).Subtract(ageRange.To);
         var endDate = new GetInDate(DateTime.Now).Subtract(ageRange.From);
         lookupCriteria.Add(Restrictions.Between("DateOfBirth", beginDate, endDate));
     }
     return lookupCriteria.List<User>();
 }
Exemplo n.º 13
0
        public void ShouldStoreUserProfileTextOfMaxLength()
        {
            var loginid = new LoginId("*****@*****.**");
            var name = new Name("firstName", "lastName");

            System.String tooBigText = getBigProfileText("../../../GetIn/MaxProfile.txt");
            var profile = new Profile(tooBigText);

            var user = new User(loginid, name) { Profile = profile };

            session.Save(user);

            IList<User> users = session.CreateQuery("from User").List<User>();
            Assert.AreEqual(profile, users.First().Profile);
        }
Exemplo n.º 14
0
        public void LookupUserBasedOnLocation()
        {
            User usr1 = new User(null, new Name(null, null));
            usr1.Location = new Location {City = "Banglore"};
            IList<User> results1 = usrRep.LookupUsers(usr1);
            Assert.AreEqual(2, results1.Count());

            User usr2 = new User(null, new Name(null, null));
            usr2.Location = new Location {Country = "USA"};
            IList<User> results2 = usrRep.LookupUsers(usr2);
            Assert.AreEqual(1, results2.Count());

            User usr3 = new User(null, new Name(null, null));
            usr3.Location = new Location {Country = "Canada"};
            IList<User> results3 = usrRep.LookupUsers(usr3);
            Assert.AreEqual(0, results3.Count());
        }
Exemplo n.º 15
0
        public void DegreeOfSeparationShouldBeOneWhenDirectFriends()
        {
            IUserRepository repository = new UserRepository(session);

            var loginid = new LoginId("*****@*****.**");
            var name = new Name("Suchit", "Puri");
            var suchit = new User(loginid, name) { Repository = repository };

            var loginid2 = new LoginId("*****@*****.**");
            var name2 = new Name("Sumit", "Gupta");
            var sumit = new User(loginid2, name2) { Repository = repository };

            repository.Save(sumit);
            repository.Save(suchit);

            suchit.InviteFriend(sumit);
            sumit.AcceptFriendInvite(suchit);
            session.Flush();
            session.Evict(suchit);
            session.Evict(sumit);
            Assert.AreEqual(1, sumit.DegreeOfSeparation(suchit).Count);
        }
Exemplo n.º 16
0
 public void UserShouldBeAbleToSaveComments()
 {
     IUserRepository repository = new UserRepository(_session);
     repository.Save(new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1")));
     var user2 = new User(new LoginId("*****@*****.**"), new Name("firstName2", "lastName2")) { Profile = new Profile("This is the profile on which user1 will comment") };
     new Comment(new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1")), user2, "This is what I am going to comment");
     repository.Save(user2);
     User interestedUser = null;
     IList<User> users = _session.CreateQuery("from User").List<User>();
     foreach (User user in users){
         if (user.LoginId.Value == new LoginId("*****@*****.**").Value){
             interestedUser = user;
             break;
         }
     }
     if (interestedUser != null){
         Assert.AreEqual("This is what I am going to comment", interestedUser.GetLatestProfileComment().Content);
         Assert.AreEqual(new User(new LoginId("*****@*****.**"), new Name("firstName1", "lastName1")),interestedUser.GetLatestProfileComment().Commentor);
     }
     else{
         Assert.Fail();
     }
 }
Exemplo n.º 17
0
        public void UserCannotPostToUnsubscribedGroup()
        {
            Mock<Group> mockGroup = new Mock<Group>();
            Post post = new Post() {Content = "Some stupid content", PostedDateTime = new DateTime(2010, 01, 01)};

            Group group = mockGroup.Object;
            mockGroup.Setup(foo => foo.post(post));

            LoginId loginid = new LoginId("*****@*****.**");
            string firstname = "firstName";
            string lastname = "lastName";
            Name name = new Name(firstname, lastname);

            User footballFan = new User(loginid, name);

            try
            {
                footballFan.PostToGroup(group, post);
                Assert.Fail("Failed");
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 18
0
        public void ShouldNotBeAbleToCreateGroupIfAlreadyExists()
        {
            User user = new User(new LoginId("123"), null);
            Group group = new Group() {Name = "Nature-Lovers"};
            var repositoryMock = new Moq.Mock<IGroupRepository>();
            user.GroupRepository = repositoryMock.Object;
            repositoryMock.Setup(p => p.Exists(group)).Returns(true);

            try{
                user.CreateGroup(group);
                Assert.Fail("exception expected");
            }
            catch (GroupAlreadyExistsException){
            }

            repositoryMock.VerifyAll();
        }
Exemplo n.º 19
0
 public IList<User> LookupUsers(User user)
 {
     var lookupCriteria = BuildLookupCriteria(user);
     Console.WriteLine(lookupCriteria.List<User>());
     return lookupCriteria.List<User>();
 }
Exemplo n.º 20
0
 public UserAlreadyExistsException(User usr)
     : base(string.Format("User {0} already exists.", usr.LoginId.Value))
 {
 }
Exemplo n.º 21
0
        private ICriteria BuildLookupCriteria(User user)
        {
            ICriteria lookupCriteria = Session.CreateCriteria(typeof(User));
            if (user.LoginId != null)
            {
                AddRestriction(lookupCriteria, "LoginId", user.LoginId, true);
            }
            if (user.Name != null)
            {
                AddRestriction(lookupCriteria, "Name.FirstName", user.Name.FirstName, false);
                AddRestriction(lookupCriteria, "Name.LastName", user.Name.LastName, false);
            }
            if (user.Location != null)
            {
                AddRestriction(lookupCriteria, "Location.Country", user.Location.Country, false);
                AddRestriction(lookupCriteria, "Location.City", user.Location.City, false);
                AddRestriction(lookupCriteria, "Location.ZipCode", user.Location.ZipCode, false);
            }
            AddRestriction(lookupCriteria, "Gender", user.Gender, true);
            if (user.Profile != null && !String.IsNullOrEmpty(user.Profile.ProfileText)){
                Profile wildCardProfile = new Profile("%" + user.Profile.ProfileText + "%");
                AddRestriction(lookupCriteria, "Profile", wildCardProfile, false);
            }

            return lookupCriteria;
        }
Exemplo n.º 22
0
        public void ShouldNotBeAbleToRegisterUserIfAlreadyExists()
        {
            LoginId loginid = new LoginId("*****@*****.**");
            Name name = new Name("firstName", "lastName");

            var likes = new[]
                               {
                                   new Like() {UserId = loginid, Text = "Like1"},
                                   new Like() {UserId = loginid, Text = "Like2"},
                                   new Like() {UserId = loginid, Text = "Like3"},
                               };

            var dislikes = new[]
                               {
                                   new Dislike() {UserId = loginid, Text = "Dislike1"},
                                   new Dislike() {UserId = loginid, Text = "Dislike2"},
                                   new Dislike() {UserId = loginid, Text = "Dislike3"},
                               };

            User user = new User(loginid, name)
            {
                DateOfBirth = new GetInDate(DateTime.Today.AddYears(-25)),
                Location = new Location { City = "Banglore" },
                Gender = new Gender(),
                Likes = new HashedSet<Like>(likes),
                Dislikes = new HashedSet<Dislike>(dislikes),
                Picture = new Photo { Bytes = new byte[] { 1, 2, 3, 4, 5 } },
                Profile = new Profile("Big Profile")
            };

            var repositoryMock = new Moq.Mock<IUserRepository>();
            repositoryMock.Setup(p => p.LookupUsers(It.IsAny<User>())).Returns(new List<User> { user });
            user.Repository = repositoryMock.Object;
            Assert.Throws(typeof(UserAlreadyExistsException), user.Register);
            repositoryMock.VerifyAll();
        }
Exemplo n.º 23
0
 public void LookUpBasedOnId()
 {
     User usr1 = new User(new LoginId("123"), new Name(null, null));
     IList<User> results2 = usrRep.LookupUsers(usr1);
     Assert.AreEqual(1, results2.Count());
 }
Exemplo n.º 24
0
        public void UserShouldBeAbleToComputeSimilarityScoreWithAnotherUser()
        {
            LoginId loginId1 = new LoginId("*****@*****.**");
            string firstname1 = "firstName";
            string lastname1 = "lastName";
            Name name1 = new Name(firstname1, lastname1);

            Like[] likes1 = new Like[]
                               {
                                   new Like() {UserId = loginId1, Text = "Like1"},
                                   new Like() {UserId = loginId1, Text = "Like2"},
                                   new Like() {UserId = loginId1, Text = "Like3"},
                               };

            Dislike[] dlikes1 = new Dislike[]
                                   {
                                       new Dislike() {UserId = loginId1, Text = "Dislike1"},
                                       new Dislike() {UserId = loginId1, Text = "Dislike2"},
                                       new Dislike() {UserId = loginId1, Text = "Dislike3"},
                                   };

            User currentUser = new User(loginId1, name1)
            {
                Likes = new HashedSet<Like>(likes1),
                Dislikes = new HashedSet<Dislike>(dlikes1),
            };

            LoginId loginId2 = new LoginId("*****@*****.**");
            Like[] likes2 = new Like[]
                               {
                                   new Like() {UserId = loginId2, Text = "Like1"},
                                   new Like() {UserId = loginId2, Text = "Like2"},
                                   new Like() {UserId = loginId2, Text = "Like4"},
                               };
            Dislike[] dlikes2 = new Dislike[]
                                   {
                                       new Dislike() {UserId = loginId2, Text = "Dislike1"},
                                       new Dislike() {UserId = loginId2, Text = "Dislike4"},
                                       new Dislike() {UserId = loginId2, Text = "Dislike5"},
                                   };

            User anotherUser = new User(loginId2, new Name("anotherFirstName", "anotherLastName"))
            {
                Likes = new HashedSet<Like>(likes2),
                Dislikes = new HashedSet<Dislike>(dlikes2),
            };

            Assert.AreEqual(2.7d, currentUser.SimilarityScore(anotherUser));
        }
Exemplo n.º 25
0
 public void UserShouldBeAbleToJoinGroup()
 {
     User user = new User(new LoginId("123"), null);
     Group group = new Group("Nature-Lovers");
     user.Join(group);
     Assert.AreEqual(1, user.Groups.Count());
     Assert.True(user.Groups.Contains(group));
 }
Exemplo n.º 26
0
        public void LookupUsersBasedOnName()
        {
            User usr1 = new User(null,new Name("Mark", null));
            IList<User> results1 = usrRep.LookupUsers(usr1);
            Assert.AreEqual("123", results1[0].LoginId.Value);

            User usr2 = new User(null,new Name(null, "anto"));
            IList<User> results2 = usrRep.LookupUsers(usr2);
            Assert.AreEqual("678", results2[0].LoginId.Value);
        }
Exemplo n.º 27
0
        private void repositorySetUp()
        {
            user1 = new User(new LoginId("123"), new Name("Mark", "Twain"))
                        {
                            DateOfBirth = new GetInDate(DateTime.Today.AddYears(-19)),
                            Location = new Location {City = "Banglore", Country = "India"},
                            Gender = new Gender('F'),
                            Picture = new Photo {Bytes = new byte[] {1, 2, 3, 4, 5}},
                            Profile = new Profile("Big Profile"),
                        };

            user2 = new User(new LoginId("345"), new Name("Sudhakar", "Rayavaram"))
                        {
                            DateOfBirth = new GetInDate(DateTime.Today.AddYears(-28)),
                            Location = new Location {City = "Seattle", Country = "USA"},
                            Gender = new Gender(),
                            Picture = new Photo {Bytes = new byte[] {1, 2, 3, 4, 5}},
                            Profile = new Profile("Short and sweet crap"),
                        };

            user3 = new User(new LoginId("678"), new Name("Alex", "Anto"))
                        {
                            DateOfBirth = new GetInDate(DateTime.Today.AddYears(-25)),
                            Location = new Location {City = "Banglore", Country = "India"},
                            Gender = new Gender(),
                            Picture = new Photo {Bytes = new byte[] {1, 2, 3, 4, 5}},
                            Profile = new Profile("Some profile information which is useless!!! \n Some more crap!"),
                        };

            user4 = new User(new LoginId("202"), new Name("Alex", "Anto"))
                        {
                            DateOfBirth = new GetInDate(DateTime.Today.AddYears(-25)),
                            Location = new Location {City = "Banglore", Country = "India"},
                            Gender = new Gender(),
                            Picture = new Photo {Bytes = new byte[] {1, 2, 3, 4, 5}},
                            Profile = new Profile("Some profile information which is useless!!! \n Some more crap!"),
                        };
        }
Exemplo n.º 28
0
 public void Save(User user)
 {
     Session.Save(user);
 }
Exemplo n.º 29
0
        public void DegreeOfSeparationShouldBeThreeWhenThreeIndirectFrindsBetweenInputUsers()
        {
            IUserRepository repository = new UserRepository(session);

            var loginid = new LoginId("*****@*****.**");
            var name = new Name("Suchit", "Puri");
            var suchit = new User(loginid, name) { Repository = repository };

            var loginid2 = new LoginId("*****@*****.**");
            var name2 = new Name("Sumit", "Gupta");
            var sumit = new User(loginid2, name2) { Repository = repository };

            var loginid3 = new LoginId("*****@*****.**");
            var name3 = new Name("Manav", "Prasad");
            var manav = new User(loginid3, name3) { Repository = repository };

            var loginid4 = new LoginId("*****@*****.**");
            var name4 = new Name("Krishna", "Prasad");
            var krishna = new User(loginid4, name4) { Repository = repository };

            repository.Save(sumit);
            repository.Save(suchit);
            repository.Save(manav);
            repository.Save(krishna);

            suchit.InviteFriend(sumit);
            sumit.AcceptFriendInvite(suchit);
            sumit.InviteFriend(manav);
            manav.AcceptFriendInvite(sumit);

            manav.InviteFriend(krishna);
            krishna.AcceptFriendInvite(manav);

            session.Flush();
            session.Evict(suchit);
            session.Evict(sumit);
            session.Evict(manav);
            session.Evict(krishna);
            Assert.AreEqual(3, suchit.DegreeOfSeparation(krishna).Count);
        }
Exemplo n.º 30
0
        private void LookUsersSetUp()
        {
            user1 = new User(new LoginId("123"), new Name("Mark", "Twain"))
            {
                DateOfBirth = new GetInDate(DateTime.Today.AddYears(-19)),
                Location = new Location { City = "Banglore", Country = "India"},
                Gender = new Gender('F'),
                Picture = new Photo { Bytes = new byte[] { 1, 2, 3, 4, 5 } },
                Profile = new Profile("Big Profile"),
                Likes = new HashedSet<Like>(new[]
                               {
                                   new Like() {UserId = new LoginId("123"), Text = "Like1"},
                                   new Like() {UserId = new LoginId("123"), Text = "Like2"},
                                   new Like() {UserId = new LoginId("123"), Text = "Like3"},
                               }),
                Dislikes = new HashedSet<Dislike>(new[]
                               {
                                   new Dislike() {UserId = new LoginId("123"), Text = "Dislike1"},
                                   new Dislike() {UserId = new LoginId("123"), Text = "Dislike2"},
                                   new Dislike() {UserId = new LoginId("123"), Text = "Dislike3"},
                               }),
            };
            usrRep.Save(user1);
            user2 = new User(new LoginId("345"), new Name("Sudhakar", "Rayavaram"))
            {
                DateOfBirth = new GetInDate(DateTime.Today.AddYears(-28)),
                Location = new Location { City = "Seattle", Country = "USA"},
                Gender = new Gender(),
                Picture = new Photo { Bytes = new byte[] { 1, 2, 3, 4, 5 } },
                Profile = new Profile("Short and sweet crap"),
                Likes = new HashedSet<Like>(new[]
                               {
                                   new Like() {UserId = new LoginId("345"), Text = "Like3"},
                                   new Like() {UserId = new LoginId("345"), Text = "Like4"},
                                   new Like() {UserId = new LoginId("345"), Text = "Like5"},
                               }),
                Dislikes = new HashedSet<Dislike>(new[]
                               {
                                   new Dislike() {UserId = new LoginId("345"), Text = "Dislike3"},
                                   new Dislike() {UserId = new LoginId("345"), Text = "Dislike4"},
                                   new Dislike() {UserId = new LoginId("345"), Text = "Dislike5"},
                               }),
            };
            usrRep.Save(user2);
            user3 = new User(new LoginId("678"), new Name("Alex", "Anto"))
            {
                DateOfBirth = new GetInDate(DateTime.Today.AddYears(-25)),
                Location = new Location { City = "Banglore", Country = "India"},
                Gender = new Gender(),
                Picture = new Photo { Bytes = new byte[] { 1, 2, 3, 4, 5 } },
                Profile = new Profile("Some profile information which is useless!!! \n Some more crap!"),
                Likes = new HashedSet<Like>(new[]
                               {
                                   new Like() {UserId = new LoginId("678"), Text = "Like1"},
                                   new Like() {UserId = new LoginId("678"), Text = "Like4"},
                                   new Like() {UserId = new LoginId("678"), Text = "Like2"},
                               }),
                Dislikes = new HashedSet<Dislike>(new[]
                               {
                                   new Dislike() {UserId = new LoginId("678"), Text = "Dislike1"},
                                   new Dislike() {UserId = new LoginId("678"), Text = "Dislike4"},
                                   new Dislike() {UserId = new LoginId("678"), Text = "Dislike3"},
                               }),
            };
            usrRep.Save(user3);
            user1.Friends.Add(user2);
            user1.Friends.Add(user3);
            user2.Friends.Add(user3);
            //            user3.Friends.Add(user1);
            loner = new User(new LoginId("91011"), new Name("Vivek", "Jain"))
            {
                DateOfBirth = new GetInDate(DateTime.Today.AddYears(-28)),
                Location = new Location { City = "Calcutta", Country = "India" },
                Gender = new Gender(),
                Picture = new Photo { Bytes = new byte[] { 1, 2, 3, 4, 5 } },
                Profile = new Profile("Some profile information which is useless!!! \n Some more crap! Some more crap!"),
                Likes = new HashedSet<Like>(new[]
                               {
                                   new Like() {UserId = new LoginId("91011"), Text = "Like4"},
                                   new Like() {UserId = new LoginId("91011"), Text = "Like7"},
                                   new Like() {UserId = new LoginId("91011"), Text = "Like9"},
                               }),
                Dislikes = new HashedSet<Dislike>(new[]
                               {
                                   new Dislike() {UserId = new LoginId("91011"), Text = "Dislike1"},
                                   new Dislike() {UserId = new LoginId("91011"), Text = "Dislike5"},
                               }),
            };
            usrRep.Save(loner);

            user1.GroupRepository = gpRep;
            user2.GroupRepository = gpRep;
            user3.GroupRepository = gpRep;
        }