Exemplo n.º 1
0
        private User CreateUser(UserDto userData)
        {
            UserId identity = new UserId()
            {
                Name     = userData.name,
                Surname  = userData.surname,
                UserName = userData.username,
                Password = userData.password,
                Email    = userData.email
            };

            User created = userData.isAdmin ? factory.CreateAdmin(identity) : factory.CreateFollower(identity);

            return(created);
        }
Exemplo n.º 2
0
        public User ToUser(UserEntity toConvert, ICollection <TeamEntity> teamEntities)
        {
            UserId identity = new UserId()
            {
                Name     = toConvert.Name,
                Surname  = toConvert.Surname,
                UserName = toConvert.UserName,
                Password = toConvert.Password,
                Email    = toConvert.Email
            };
            ICollection <Team> teams = teamEntities.Select(t => teamConverter.ToTeam(t)).ToList();
            User converted;

            converted = toConvert.IsAdmin ? factory.CreateAdmin(identity, teams) : factory.CreateFollower(identity, teams);
            return(converted);
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            identity = new UserId()
            {
                Name     = "name",
                Surname  = "surname",
                UserName = "******",
                Password = "******",
                Email    = "*****@*****.**"
            };

            factory         = new UserFactory();
            anAdmin         = new User(identity, true);
            factoryAdmin    = factory.CreateAdmin(identity);
            aFollower       = new User(identity, false);
            factoryFollower = factory.CreateFollower(identity);
        }