Beispiel #1
0
        public void EmptyAndCreate()
        {
            EmptyTable();

            Colaborator colaborator1 = new Colaborator();

            colaborator1.name     = "Colab";
            colaborator1.surname  = "Orator";
            colaborator1.mail     = "*****@*****.**";
            colaborator1.password = "******";
            colaborator1.birthday = new DateTime(1992, 9, 10);
            colaborator1.teams    = new List <Team>();
            Colaborators.Add(colaborator1);
            SaveChanges();

            Administrator administrator1 = new Administrator();

            administrator1.name     = "Admin";
            administrator1.surname  = "Istrator";
            administrator1.mail     = "*****@*****.**";
            administrator1.password = "******";
            administrator1.birthday = new DateTime(1992, 9, 10);
            administrator1.teams    = new List <Team>();
            Administrators.Add(administrator1);
            SaveChanges();

            Team team1 = new Team();

            team1.name         = "Team 1";
            team1.maxUsers     = 5;
            team1.description  = "This is the description.";
            team1.creator      = administrator1;
            team1.creationDate = DateTime.Now;
            List <User> usersInTeam = new List <User>();

            usersInTeam.Add(administrator1);
            team1.usersInTeam = usersInTeam;
            Teams.Add(team1);
            SaveChanges();

            Team team2 = new Team();

            team2.name         = "Team 2";
            team2.maxUsers     = 3;
            team2.description  = "Description";
            team2.creator      = administrator1;
            team2.creationDate = DateTime.Now;
            List <User> usersInTeam2 = new List <User>();

            usersInTeam2.Add(administrator1);
            usersInTeam2.Add(colaborator1);
            team2.usersInTeam = usersInTeam2;
            Teams.Add(team2);
            SaveChanges();

            administrator1.teams.Add(team1);
            SaveChanges();
            administrator1.teams.Add(team2);
            SaveChanges();
            colaborator1.teams.Add(team2);
            SaveChanges();
        }