Ejemplo 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);
        }
Ejemplo n.º 2
0
 public void SetUp()
 {
     factory = new UserFactory();
     userId  = new UserId()
     {
         Name     = "name",
         Surname  = "surname",
         UserName = "******",
         Password = "******",
         Email    = "*****@*****.**"
     };
     user = factory.CreateAdmin(userId);
     CreateRepository();
     usersStorage.Clear();
     teamsStorage.Clear();
 }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
        public void StartUp()
        {
            factory = new UserFactory();
            UserId identity = new UserId
            {
                Name     = "name",
                Surname  = "surname",
                UserName = "******",
                Password = "******",
                Email    = "*****@*****.**"
            };

            toStore = factory.CreateAdmin(identity);
            toGet   = new UserEntity()
            {
                Name     = "name",
                Surname  = "surname",
                UserName = "******",
                Password = "******",
                Email    = "*****@*****.**"
            };
            toTest = new UserMapper();
        }
Ejemplo n.º 6
0
        public void GetUserTest()
        {
            User user = factory.CreateAdmin(userId);

            usersStorage.Add(user);
            User fetched = usersStorage.Get("username");

            Assert.AreEqual("name", fetched.Name);
        }