public void LoadAdministratorsOk()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administrator1 = DataCreation.CreateAdministrator(nameOK, surnameOK, anotherMailOk, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);

            administratorHandler.AddAdministrator(administrator1);

            List <User> allUsers = new List <User>();

            allUsers.Add(administrator);

            allUsers.Add(administrator1);

            bool loadOk = true;

            foreach (User user in userHandler.LoadUsers())
            {
                if (!allUsers.Contains(user))
                {
                    loadOk = false;
                }
            }

            Assert.IsTrue(loadOk);
        }
Ejemplo n.º 2
0
        public void TeamOKCreatedByAdministrator()
        {
            administratorCreator = DataCreation.CreateAdministrator(userNameOK, userSurnameOK, userMailOK, userPasswordOK, userBirthdayOk);

            colaboratorCreator = DataCreation.CreateColaborator(userNameOK, userSurnameOK, anotherUserMailOK, userPasswordOK, userBirthdayOk);

            usersInTeam = new List <User>();

            usersInTeam.Add(administratorCreator);

            usersInTeam.Add(colaboratorCreator);

            administratorHandler.AddAdministrator(administratorCreator);

            colaboratorHandler.AddColaborator(colaboratorCreator);

            team = DataCreation.CreateTeam(nameOK, dateOK, administratorCreator, descriptionOK, maxUsersOK, usersInTeam);

            Team team1 = DataCreation.CreateTeam("team2", dateOK, administratorCreator, descriptionOK, maxUsersOK, usersInTeam);

            teamHandler.AddTeam(team);

            teamHandler.AddTeam(team1);

            Assert.IsTrue(teamPersistence.ExistsTeam(teamHandler.GetTeamFromCollection(team.name)));
        }
        public void AdminisitratorGetTeamsOk()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            usersInTeam = new List <User>();

            usersInTeam.Add(administrator);

            team = DataCreation.CreateTeam(teamNameOK, teamDateOK, administrator, descriptionOK, maxUsersOK, usersInTeam);

            administratorHandler.AddAdministrator(administrator);

            teamHandler.AddTeam(team);

            administrator.teams.Add(team);

            bool getTeamOk = true;

            foreach (Team teamFromUser in userHandler.GetTeams(administrator))
            {
                if (!administrator.teams.Contains(teamFromUser))
                {
                    getTeamOk = false;
                }
            }

            Assert.IsTrue(getTeamOk);
        }
        public void AdministratorNameWithNumbers()
        {
            string invalidName = "J04c0";

            administrator = DataCreation.CreateAdministrator(invalidName, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorInvalidBirthDate()
        {
            DateTime invalidBirthday = new DateTime(9999, 1, 1);

            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, invalidBirthday);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorMailNoName()
        {
            string invalidMail = "@gmail.com";

            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, invalidMail, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorNullMail()
        {
            string invalidMail = null;

            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, invalidMail, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorPasswordTooSmall()
        {
            string invalidPassword = "******";

            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, invalidPassword, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorPasswordNoLetters()
        {
            string invalidPassword = "******";

            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, invalidPassword, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorSurnameWithMoreThanOneSpaceInTheMiddle()
        {
            string invalidSurname = "Oribe   Bajac";

            administrator = DataCreation.CreateAdministrator(nameOK, invalidSurname, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorSurnameWithSpecialCharacters()
        {
            string invalidSurname = "#@?_";

            administrator = DataCreation.CreateAdministrator(nameOK, invalidSurname, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorSurnameWithNumbers()
        {
            string invalidSurname = "0rib3";

            administrator = DataCreation.CreateAdministrator(nameOK, invalidSurname, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorSurnameWithOnlyEmptySpaces()
        {
            string invalidSurname = "     ";

            administrator = DataCreation.CreateAdministrator(nameOK, invalidSurname, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorSurnameWithSpacesInTheBegining()
        {
            string invalidSurname = "           Oribe";

            administrator = DataCreation.CreateAdministrator(nameOK, invalidSurname, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorNullSurname()
        {
            string invalidSurname = null;

            administrator = DataCreation.CreateAdministrator(nameOK, invalidSurname, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorNameWithMoreThanOneSpaceInTheMiddle()
        {
            string invalidName = "Joaco   Sabe";

            administrator = DataCreation.CreateAdministrator(invalidName, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorPasswordNoNumbers()
        {
            string invalidPassword = "******";

            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, invalidPassword, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AddTheSameAdministrator()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdministratorNameWithSpacesInTheBegining()
        {
            string invalidName = "     Joaco";

            administrator = DataCreation.CreateAdministrator(invalidName, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
Ejemplo n.º 20
0
        public void AdministratorNull()
        {
            administrator1 = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administrator2 = null;

            Assert.IsFalse(administrator1.Equals(administrator2));
        }
Ejemplo n.º 21
0
        public void AdministratorSameEmail()
        {
            administrator1 = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administrator2 = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            Assert.IsTrue(administrator1.Equals(administrator2));
        }
Ejemplo n.º 22
0
        public void AdministratorDifferentEmail()
        {
            administrator1 = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administrator2 = DataCreation.CreateAdministrator(nameOK, surnameOK, anotherMailOK, passwordOK, birthdayOk);

            Assert.IsFalse(administrator1.Equals(administrator2));
        }
        public void AdministratorEmptyName()
        {
            string invalidName = "";

            administrator = DataCreation.CreateAdministrator(invalidName, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);
        }
        public void AdminisitratorOK()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);

            Assert.IsTrue(userPersistance.ExistsUser(userHandler.GetUserFromColecction(administrator.mail)));
        }
Ejemplo n.º 25
0
        public void AdministratorLoginWrongMail()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);

            string invalidMail = "invalidMail";

            sessionHandler.LogInAdministrator(invalidMail, administrator.mail);
        }
Ejemplo n.º 26
0
        public void AdministratorLoginOk()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);

            Session actualSession = sessionHandler.LogInAdministrator(administrator.mail, administrator.password);

            Assert.AreEqual(administrator.mail, actualSession.user.mail);
        }
Ejemplo n.º 27
0
        public void AdministratorLoginUserNotExist()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);

            string notExistUser = "******";

            sessionHandler.LogInAdministrator(notExistUser, administrator.mail);
        }
        public void AdminisitratorDeleteOk()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);

            userHandler.DeleteUser(administrator.mail);

            Assert.IsFalse(userHandler.GetUserFromColecction(administrator.mail).active);
        }
Ejemplo n.º 29
0
        public void TeamUserCollectionNull()
        {
            administratorCreator = DataCreation.CreateAdministrator(userNameOK, userSurnameOK, userMailOK, userPasswordOK, userBirthdayOk);

            usersInTeam = null;

            team = DataCreation.CreateTeam(nameOK, dateOK, administratorCreator, descriptionOK, maxUsersOK, usersInTeam);

            teamHandler.AddTeam(team);
        }
        public void AdminisitratorDeleteMailInvalid()
        {
            administrator = DataCreation.CreateAdministrator(nameOK, surnameOK, mailOK, passwordOK, birthdayOk);

            administratorHandler.AddAdministrator(administrator);

            string mailInvalid = "notValidMail";

            userHandler.DeleteUser(mailInvalid);
        }