public void TestCreateGroup()
        {
            //Create user1
            UserProfileDetails user1Details = new UserProfileDetails("testUserName1", "testLastName1", "*****@*****.**", "en", "US");
            long userId = userService.RegisterUser("testLogin1", "passwordtest1", user1Details);

            //User1 creates group
            long             group1Id  = recommendationGroupService.CreateGroup("tesNameGroup1", "testDescriptionGroup1", "testLogin1");
            List <DTOGroups> AllGroups = recommendationGroupService.ShowAllGroups();
            int countAllGroups         = AllGroups.Count;

            Assert.AreEqual(countAllGroups, 1);

            //User1 creates 2 groups
            long group2Id = recommendationGroupService.CreateGroup("tesNameGroup2", "testDescriptionGroup2", "testLogin1");

            AllGroups      = recommendationGroupService.ShowAllGroups();
            countAllGroups = AllGroups.Count;

            Assert.AreEqual(countAllGroups, 2);

            long group3Id = recommendationGroupService.CreateGroup("tesNameGroup3", "testDescriptionGroup3", "testLogin1");

            AllGroups      = recommendationGroupService.ShowAllGroups();
            countAllGroups = AllGroups.Count;
            Assert.AreEqual(countAllGroups, 3);

            //Check group information
            DTOGroups group1 = AllGroups[0];
            DTOGroups group2 = AllGroups[1];
            DTOGroups group3 = AllGroups[2];

            Assert.AreEqual(group1.group_usersId, group1Id);
            Assert.AreEqual(group2.group_usersId, group2Id);
            Assert.AreEqual(group3.group_usersId, group3Id);

            Assert.AreEqual("testDescriptionGroup1", group1.gr_description);
            Assert.AreEqual("testDescriptionGroup2", group2.gr_description);
            Assert.AreEqual("testDescriptionGroup3", group3.gr_description);

            Assert.AreEqual(group1.gr_name, "tesNameGroup1");
            Assert.AreEqual(group2.gr_name, "tesNameGroup2");
            Assert.AreEqual(group3.gr_name, "tesNameGroup3");

            ////Check user is the group owner
            //Assert.AreEqual(group1.gr_login_owner, "testLogin1");
            //Assert.AreEqual(group2.gr_login_owner, "testLogin1");
            //Assert.AreEqual(group3.gr_login_owner, "testLogin1");

            ////Check owner is into users group list
            //ICollection<UserProfile> usersGroup1 = group1.UsersOnGroup;

            //Assert.AreEqual(usersGroup1.Count, 1);
            //foreach (var usr in usersGroup1)
            //{
            //    Assert.AreEqual(usr.userId, userId);
            //    Assert.AreEqual(usr.loginName, "testLogin1");
            //    Assert.AreEqual(usr.lastName, "testLastName1");
            //}
        }
Example #2
0
        /// <exception cref="InstanceNotFoundException"/>
        public void UpdateUserProfileDetails(long userProfileId,
                                             UserProfileDetails userProfileDetails)
        {
            long usrIdByEmail = -1;

            try
            {
                usrIdByEmail = UserProfileDao.FindByEmail(userProfileDetails.Email).usrId;
                if (userProfileId != usrIdByEmail)
                {
                    throw new DuplicateEmailException(userProfileDetails.Email);
                }
                UserProfile userProfile =
                    UserProfileDao.Find(userProfileId);
                userProfile.firstName = userProfileDetails.FirstName;
                userProfile.lastName  = userProfileDetails.Lastname;
                userProfile.email     = userProfileDetails.Email;
                userProfile.language  = userProfileDetails.Language;
                userProfile.country   = userProfileDetails.Country;
                UserProfileDao.Update(userProfile);
            }
            catch (InstanceNotFoundException)
            {
                UserProfile userProfile =
                    UserProfileDao.Find(userProfileId);
                userProfile.firstName = userProfileDetails.FirstName;
                userProfile.lastName  = userProfileDetails.Lastname;
                userProfile.email     = userProfileDetails.Email;
                userProfile.language  = userProfileDetails.Language;
                userProfile.country   = userProfileDetails.Country;
                UserProfileDao.Update(userProfile);
            }
        }
Example #3
0
        protected void addComentario_Click(object sender, EventArgs e)
        {
            try {
                if (SessionManager.IsUserAuthenticated(Context))
                {
                    String             contentComment     = introducirComentario.Text;
                    UserProfileDetails userProfileDetails =
                        SessionManager.FindUserProfileDetails(Context);
                    String      email = userProfileDetails.Email;
                    UserProfile u     = userService.FindUserByEmail(email);

                    DateTime commentDate = DateTime.Now;

                    Comment c = new Comment();
                    c.content     = contentComment;
                    c.loginName   = u.loginName;
                    c.commentDate = commentDate;
                    c.Event       = evento;
                    eventService.AddComment(contentComment, evento.eventId, u.usrId);
                }
            }
            catch {
                throw new Exception();
            }
        }
        public void TestOwnerDeleteGroup()
        {
            //Create user1
            UserProfileDetails user1Details = new UserProfileDetails("testUserName1", "testLastName1", "*****@*****.**", "en", "US");
            long userId = userService.RegisterUser("testLogin1", "passwordtest1", user1Details);
            //Create user2
            UserProfileDetails user2Details = new UserProfileDetails("testUserName2", "testLastName2", "*****@*****.**", "en", "US");
            long user2Id = userService.RegisterUser("testLogin2", "passwordtest2", user2Details);
            //Create user3
            UserProfileDetails user3Details = new UserProfileDetails("testUserName3", "testLastName3", "*****@*****.**", "en", "US");
            long user3Id = userService.RegisterUser("testLogin3", "passwordtest1", user3Details);

            //User1 creates group
            long group1Id = recommendationGroupService.CreateGroup("tesNameGroup1", "testDescriptionGroup1", "testLogin1");

            // 2 User on Group1
            recommendationGroupService.AddUserToGroup("testLogin2", group1Id);
            recommendationGroupService.AddUserToGroup("testLogin3", group1Id);

            // User 1(owner) delete Group
            recommendationGroupService.DeleteGroup("testLogin1", group1Id);

            //Check Users on Group
            List <DTOGroups> groupsList = recommendationGroupService.ShowAllGroups();

            Assert.AreEqual(groupsList.Count, 0);

            List <DTOGroupsUser> groupsUser1 = recommendationGroupService.ShowUserGroups("testLogin1");
            List <DTOGroupsUser> groupsUser2 = recommendationGroupService.ShowUserGroups("testLogin2");
            List <DTOGroupsUser> groupsUser3 = recommendationGroupService.ShowUserGroups("testLogin3");

            Assert.AreEqual(groupsUser1.Count, 0);
            Assert.AreEqual(groupsUser2.Count, 0);
            Assert.AreEqual(groupsUser3.Count, 0);
        }
Example #5
0
        public void UpdateUserProfileDetailsTest()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                // Register user and update profile details
                long userId = userService.RegisterUser(loginName, clearPassword,
                                                       new UserProfileDetails(firstName, lastName, email, language, country, postalAddress));

                UserProfileDetails expected =
                    new UserProfileDetails(firstName + "X", lastName + "X",
                                           email + "X", "XX", "XX", postalAddress);

                userService.UpdateUserProfileDetails(userId, expected);

                UserProfileDetails obtained =
                    userService.FindUserProfileDetails(userId);

                // Check changes
                //Assert.AreEqual(expected, obtained);
                Assert.AreEqual(expected.FirstName, obtained.FirstName);
                Assert.AreEqual(expected.Lastname, obtained.Lastname);
                Assert.AreEqual(expected.Email, obtained.Email);
                Assert.AreEqual(expected.Country, obtained.Country);
                Assert.AreEqual(expected.Language, obtained.Language);
                Assert.AreEqual(expected.PostalAddress, obtained.PostalAddress);

                // transaction.Complete() is not called, so Rollback is executed.
            }
        }
        /// <summary>
        /// Registers the user.
        /// </summary>
        /// <param name="context">Http Context includes request, response, etc.</param>
        /// <param name="loginName">Username</param>
        /// <param name="clearPassword">Password in clear text</param>
        /// <param name="userProfileDetails">The user profile details.</param>
        /// <exception cref="DuplicateInstanceException"/>
        public static long RegisterUser(HttpContext context,
                                        String loginName, String clearPassword,
                                        UserProfileDetails userProfileDetails)
        {
            /* Register user. */
            long usrId = userService.RegisterUser(loginName, clearPassword,
                                                  userProfileDetails);

            /* Insert necessary objects in the session. */
            UserSession userSession = new UserSession();

            userSession.UserProfileId = usrId;
            userSession.Rol           = userProfileDetails.role;
            userSession.FirstName     = userProfileDetails.firstName;

            Locale locale = new Locale(userProfileDetails.language,
                                       userProfileDetails.country);

            ShoppingCartSession shoppingCart = (ShoppingCartSession)context.Session[SHOPPING_CART_SESSION_ATTRIBUTE];

            shoppingCart.Address = userProfileDetails.address;

            UpdateSessionForAuthenticatedUser(context, userSession, locale);
            UpdateCartSession(context, shoppingCart);

            FormsAuthentication.SetAuthCookie(loginName, false);

            return(usrId);
        }
        /// <summary>
        /// Updates the user profile details.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="userProfileDetails">The user profile details.</param>
        public static void UpdateUserProfileDetails(HttpContext context,
                                                    UserProfileDetails userProfileDetails)
        {
            ShoppingCartSession shoppingCart =
                (ShoppingCartSession)context.Session[SHOPPING_CART_SESSION_ATTRIBUTE];

            /* Update user's profile details. */

            UserSession userSession =
                (UserSession)context.Session[USER_SESSION_ATTRIBUTE];

            userService.UpdateUserProfileDetails(userSession.UserProfileId,
                                                 userProfileDetails);

            /* Update user's session objects. */

            Locale locale = new Locale(userProfileDetails.language,
                                       userProfileDetails.country);

            shoppingCart.Address = userProfileDetails.address;

            userSession.FirstName = userProfileDetails.firstName;

            UpdateSessionForAuthenticatedUser(context, userSession, locale);
            UpdateCartSession(context, shoppingCart);
        }
Example #8
0
        public void EditUserProfile(UserProfileDetails userProfileDetails)
        {
            var userProfile = _userProfileRepository.GetListAsNoTracking().SingleOrDefault(x => x.Id == userProfileDetails.Id);

            userProfile = Mapper.Map <UserProfile>(userProfileDetails);
            _userProfileRepository.Update(userProfile);
        }
Example #9
0
        /// <summary>
        /// Handles the Click event of the btnRegister control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance
        /// containing the event data.</param>
        protected void BtnRegisterClick(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    UserProfileDetails userProfileDetailsVO =
                        new UserProfileDetails(txtFirstName.Text, txtSurname.Text,
                                               txtEmail.Text, comboLanguage.SelectedValue,
                                               comboCountry.SelectedValue);

                    SessionManager.RegisterUser(Context, txtLogin.Text,
                                                txtPassword.Text, userProfileDetailsVO);

                    HttpCookie cookie =
                        new HttpCookie("LoginName", txtLogin.Text);
                    Response.Cookies.Add(cookie);

                    Response.Redirect(Response.
                                      ApplyAppPathModifier("~/Pages/MainPage.aspx"));
                }
                catch (DuplicateInstanceException)
                {
                    lblLoginError.Visible = true;
                }
            }
        }
Example #10
0
        /// <summary>
        /// Finds the user profile with the id stored in the session.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public static UserProfileDetails FindUserProfileDetails(HttpContext context)
        {
            UserSession userSession = (UserSession)context.Session[USER_SESSION_ATTRIBUTE];

            UserProfileDetails userProfileDetails = userService.GetUserProfile(userSession.UserProfileId);

            return(userProfileDetails);
        }
        public void TestCreateGroupNotValidUser()
        {
            //Create user1
            UserProfileDetails user1Details = new UserProfileDetails("testUserName1", "testLastName1", "*****@*****.**", "en", "US");
            long userId = userService.RegisterUser("testLogin1", "passwordtest1", user1Details);

            //Bad user creates group
            long group1Id = recommendationGroupService.CreateGroup("tesNameGroup1", "testDescriptionGroup1", "ErrorLogin");
        }
Example #12
0
        public void UpdateUserProfileTest()
        {
            UserProfile user = testUtil.CreateTestUser();

            userService.UpdateUserProfile(user.userId, testUtil.TestData.userName2, testUtil.TestData.userLastName2, testUtil.TestData.userEmail2, testUtil.TestData.userLanguage2, testUtil.TestData.userCountry2);

            UserProfileDetails actual = userService.GetUserProfile(user.userId);

            testUtil.AssertMatch(actual, testUtil.TestData.userName2, testUtil.TestData.userLastName2, testUtil.TestData.userEmail2, testUtil.TestData.userLanguage2, testUtil.TestData.userCountry2);
        }
Example #13
0
        public bool AssertMatch(UserProfileDetails userDetails, string firstName, string lastName, string email, string language, string country)
        {
            Assert.AreEqual(userDetails.FirstName, firstName);
            Assert.AreEqual(userDetails.LastName, lastName);
            Assert.AreEqual(userDetails.Email, email);
            Assert.AreEqual(userDetails.LanguageCode, language);
            Assert.AreEqual(userDetails.CountryCode, country);

            return(true);
        }
Example #14
0
        /// <summary>
        /// Handles the Click event of the btnRegister control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance
        /// containing the event data.</param>
        protected void BtnRegisterClick(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    long number = Convert.ToInt64(txtCreditNumber.Text);

                    if (!SessionManager.CardExists(number))
                    {
                        int             verification = Convert.ToInt32(txtVerificationCode.Text);
                        System.DateTime date         = DateTime.ParseExact(txtExpirationDate.Text, "MM/yy", null);
                        if (date.Year.CompareTo(System.DateTime.Now.Year) < 0 || (date.Year.CompareTo(System.DateTime.Now.Year) == 0 && date.Month.CompareTo(System.DateTime.Now.Month) < 0))
                        {
                            lblDateError.Visible   = true;
                            lblLoginError.Visible  = false;
                            lblNumberError.Visible = false;
                            return;
                        }

                        UserProfileDetails userProfileDetailsVO =
                            new UserProfileDetails(txtFirstName.Text, txtSurname.Text,
                                                   txtEmail.Text, comboLanguage.SelectedValue,
                                                   comboCountry.SelectedValue, 0, txtAddress.Text);;

                        long usrId = SessionManager.RegisterUser(Context, txtLogin.Text,
                                                                 txtPassword.Text, userProfileDetailsVO);

                        SessionManager.RegisterCreditCard(Context, comboCreditType.SelectedValue,
                                                          number, verification, true, date);

                        Response.Redirect(Response.
                                          ApplyAppPathModifier("~/Pages/MainPage.aspx"));
                    }
                    else
                    {
                        lblLoginError.Visible  = false;
                        lblNumberError.Visible = true;
                        lblDateError.Visible   = false;
                    }
                }
                catch (DuplicateInstanceException)
                {
                    lblLoginError.Visible  = true;
                    lblNumberError.Visible = false;
                    lblDateError.Visible   = false;
                }
                catch (FormatException)
                {
                    lblDateError.Visible   = true;
                    lblLoginError.Visible  = false;
                    lblNumberError.Visible = false;
                }
            }
        }
Example #15
0
        /// <exception cref="InstanceNotFoundException"/>
        public UserProfileDetails FindUserProfileDetails(long userProfileId)
        {
            UserProfile userProfile = UserProfileDao.Find(userProfileId);

            UserProfileDetails userProfileDetails =
                new UserProfileDetails(userProfile.firstName,
                                       userProfile.lastName, userProfile.email,
                                       userProfile.language, userProfile.country, userProfile.postalAddress);

            return(userProfileDetails);
        }
Example #16
0
        protected void initGridViewMyGroups()
        {
            UserProfileDetails userProfileDetails =
                SessionManager.FindUserProfileDetails(Context);
            String      email = userProfileDetails.Email;
            UserProfile u     = userService.FindUserByEmail(email);

            groupList = userService.FindGroupsByUserId(u.usrId);
            myGroupsList.DataSource = groupList;
            myGroupsList.DataBind();
        }
Example #17
0
        public void GetUserProfileTest()
        {
            /* Initialization */
            UserProfile user = testUtil.CreateTestUser();

            /* Use case */
            UserProfileDetails actual = userService.GetUserProfile(user.userId);

            /* Check */
            testUtil.AssertMatch(user, actual);
        }
Example #18
0
        protected void initGridViewMyRecommendations()
        {
            UserProfileDetails userProfileDetails =
                SessionManager.FindUserProfileDetails(Context);
            String      email = userProfileDetails.Email;
            UserProfile u     = userService.FindUserByEmail(email);

            recommendations = userService.FindGroupRecommendations(groupId, u.usrId, startIndex, count);
            recommendationList.DataSource = recommendations;
            recommendationList.DataBind();
        }
Example #19
0
        public async Task UpdateUserProfileDetailsAsync_WithNonExistentId_NotUpdatedUserProfileDetails()
        {
            var userId = Guid.NewGuid();
            var newUserProfileDetails = new UserProfileDetails
            {
                Bio = "bio updated",
            };

            var result = await _userProfileRepository
                         .UpdateUserProfileDetailsAsync(userId, newUserProfileDetails);

            Assert.Equal(0, result);
        }
Example #20
0
        public void FindUserProfileDetailsTest()
        {
            UserProfileDetails expected =
                new UserProfileDetails(firstName, lastName, email, language, country);

            long userId =
                userService.RegisterUser(loginName, clearPassword, expected);

            UserProfileDetails obtained =
                userService.FindUserProfileDetails(userId);

            // Check data
            Assert.AreEqual(expected, obtained);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                UserProfileDetails userProfileDetails = SessionManager.FindUserProfileDetails(Context);

                txtFirstName.Text = userProfileDetails.FirstName;
                txtSurname.Text   = userProfileDetails.LastName;
                txtEmail.Text     = userProfileDetails.Email;

                /* Combo box initialization */
                UpdateComboLanguage(userProfileDetails.LanguageCode);
                UpdateComboCountry(userProfileDetails.LanguageCode, userProfileDetails.CountryCode);
            }
        }
        /// <summary>
        /// Handles the Click event of the btnUpdate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance
        /// containing the event data.</param>
        protected void BtnUpdateClick(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                UserProfileDetails userProfileDetails =
                    new UserProfileDetails(txtFirstName.Text, txtSurname.Text,
                                           txtEmail.Text, comboLanguage.SelectedValue,
                                           comboCountry.SelectedValue);

                SessionManager.UpdateUserProfileDetails(Context,
                                                        userProfileDetails);

                Response.Redirect(
                    Response.ApplyAppPathModifier("~/Pages/MainPage.aspx"));
            }
        }
Example #23
0
        public void ListFavoritesIncorrectUserLoginTest()
        {
            UserProfileDetails userProfileDetails = new UserProfileDetails("first name", "last name", "*****@*****.**", "es", "ES");
            long userId = userService.RegisterUser("userLogin1", "password", userProfileDetails);

            List <DTOSportEvent> events = sportEventService.FindEvents("Event", 0, 10).result;
            DTOSportEvent        evento = null;

            foreach (var ev in events)
            {
                evento = ev;
            }

            sportEventService.AddToFavorites("userLogin1", evento.eventId, "name1", "comment1");
            List <DTOFavorite> favoritos = sportEventService.ListFavorites("incorrectUserLogin");
        }
 public void SaveUserData(UserProfileDetails userData)
 {
     if (userData.UserProfileDetailsID == 0)
     {
         context.UserProfileDetails.Add(userData);
     }
     else
     {
         UserProfileDetails dbEntry = context.UserProfileDetails.Find(userData.UserProfileDetailsID);
         if (dbEntry != null)
         {
             Mapper.Map(userData, dbEntry);
         }
     }
     context.SaveChanges();
 }
Example #25
0
        public static UserHomeModel ModelMapper(UserProfileDetails userToMap)
        {
            var _technologies = new Dictionary <string, string>();
            var _projects     = new Dictionary <string, string>();
            var _refrees      = new Dictionary <string, string[]>();
            var _images       = new List <string>();

            string expertise = string.Empty;

            foreach (var item in userToMap.Technologies)
            {
                _technologies.Add(item.Skill, item.Rating.ToString());
            }
            foreach (var item in userToMap.Projects)
            {
                _projects.Add(item.ProjectTitle, item.LinkToGitHub);
            }
            foreach (var item in userToMap.Refrees)
            {
                var array = new string[] { item.RefreeName, item.RefreeDetails, item.RefreeComments };
                _refrees.Add(item.RefreePicture, array);
            }
            foreach (var item in userToMap.Images)
            {
                _images.Add(item.ImageUrl);
            }


            UserHomeModel HomeUser = new UserHomeModel
            {
                FullName           = string.Join(" ", userToMap.FirstName, userToMap.LastName),
                PhoneNumber        = string.Join(" ", userToMap.phoneNumbers[0].CountrCode, userToMap.phoneNumbers[0].PhoneNumber),
                Technologies       = _technologies,
                Address            = string.Join(",", userToMap.MyAddress.City, userToMap.MyAddress.Country),
                UserStory          = userToMap.UserStory,
                CoreExpertise      = string.Join(", ", userToMap.AreasOfExpertise),
                EmailAddress       = userToMap.EmailAddress,
                Projects           = _projects,
                Refrees            = _refrees,
                Images             = _images,
                SocialMediaHandles = new List <string> {
                    userToMap.Handles.LinkedIn, userToMap.Handles.Twitter, userToMap.Handles.Facebook
                }
            };

            return(HomeUser);
        }
Example #26
0
        public void FindUserProfileDetailsTest()
        {
            using (var scope = new TransactionScope())
            {
                var expected =
                    new UserProfileDetails(firstName, lastName, email, language, country, role, address);

                var userId =
                    userService.RegisterUser(loginName, clearPassword, expected);

                var obtained =
                    userService.FindUserProfileDetails(userId);

                // Check data
                Assert.AreEqual(expected, obtained);
            }
        }
        public ActionResult UserProfile()
        {
            UserProfileDetails details = _userRepository.GetDetails(User.Identity.GetUserId());

            if (details != null)
            {
                UserDetailsViewModel vm = new UserDetailsViewModel()
                {
                    UserDataModel = new UserDataViewModel()
                    {
                        Id = User.Identity.GetUserId(),
                        UserProfileDetailsID = details.UserProfileDetailsID,
                        FirstName            = details.FirstName,
                        LastName             = details.LastName,
                        TelephoneNumber      = details.TelephoneNumber,
                    },
                    UserAddressModel = new UserAddressViewModel()
                    {
                        Id                = User.Identity.GetUserId(),
                        UserAddresses     = _userRepository.UserAddresses.Where(x => x.Id == User.Identity.GetUserId()),
                        Countries         = _userRepository.Countries,
                        CountiresDropDown = _userRepository.CountriesDropList
                    }
                };
                return(View(vm));
            }
            else
            {
                UserDetailsViewModel vm = new UserDetailsViewModel()
                {
                    UserDataModel = new UserDataViewModel()
                    {
                        Id = User.Identity.GetUserId(),
                    },
                    UserAddressModel = new UserAddressViewModel()
                    {
                        Id                = User.Identity.GetUserId(),
                        UserAddresses     = _userRepository.UserAddresses.Where(x => x.Id == User.Identity.GetUserId()),
                        Countries         = _userRepository.Countries,
                        CountiresDropDown = _userRepository.CountriesDropList
                    }
                };
                return(View(vm));
            }
        }
        public void TestOwnerAbandonGroup()
        {
            //Create user1
            UserProfileDetails user1Details = new UserProfileDetails("testUserName1", "testLastName1", "*****@*****.**", "en", "US");
            long userId = userService.RegisterUser("testLogin1", "passwordtest1", user1Details);
            //Create user2
            UserProfileDetails user2Details = new UserProfileDetails("testUserName2", "testLastName2", "*****@*****.**", "en", "US");
            long user2Id = userService.RegisterUser("testLogin2", "passwordtest2", user2Details);

            //User1 creates group
            long group1Id = recommendationGroupService.CreateGroup("tesNameGroup1", "testDescriptionGroup1", "testLogin1");

            // User 2 on Group1
            recommendationGroupService.AddUserToGroup("testLogin2", group1Id);

            // User 2 ( NotOwner ) delete Group
            recommendationGroupService.AbandonGroup("testLogin1", group1Id);
        }
Example #29
0
        public void UpdateUserProfileDetailsTest()
        {
            // Register user and update profile details
            long userId = userService.RegisterUser(loginName, clearPassword,
                                                   new UserProfileDetails(firstName, lastName, email, language, country));

            UserProfileDetails expected =
                new UserProfileDetails(firstName + "X", lastName + "X",
                                       email + "X", "XX", "XX");

            userService.UpdateUserProfileDetails(userId, expected);

            UserProfileDetails obtained =
                userService.FindUserProfileDetails(userId);

            // Check changes
            Assert.AreEqual(expected, obtained);
        }
Example #30
0
        public async Task UpdateUserProfileDetailsAsync_WithExistentId_UpdateUserProfileDetails()
        {
            var userId = Guid.Parse("21DCE4AF-7DFF-4D11-8BD4-2EAC339282A4");
            var newUserProfileDetails = new UserProfileDetails
            {
                Bio = "bio updated",
            };

            var result = await _userProfileRepository
                         .UpdateUserProfileDetailsAsync(userId, newUserProfileDetails);

            Assert.Equal(1, result);

            var updatedUserProfile = await _userProfileRepository
                                     .GetUserProfileAsync(userId);

            Assert.Equal(newUserProfileDetails.Bio, updatedUserProfile.UserProfileDetails.Bio);
        }
Example #31
0
        public void FindUserProfileDetailsTest()
        {
            UserProfileDetails expected =
                new UserProfileDetails(firstName, lastName, email, language, country);

            long userId =
                userService.RegisterUser(loginName, clearPassword, expected);

            UserProfileDetails obtained =
                   userService.FindUserProfileDetails(userId);

            // Check data
            Assert.AreEqual(expected, obtained);
        }
Example #32
0
        public void UpdateUserProfileDetailsTest()
        {
            // Register user and update profile details
            long userId = userService.RegisterUser(loginName, clearPassword,
                new UserProfileDetails(firstName, lastName, email, language, country));

            UserProfileDetails expected =
                    new UserProfileDetails(firstName + "X", lastName + "X",
                        email + "X", "XX", "XX");

            userService.UpdateUserProfileDetails(userId, expected);

            UserProfileDetails obtained =
                userService.FindUserProfileDetails(userId);

            // Check changes
            Assert.AreEqual(expected, obtained);
        }