Example #1
0
        public void InsertUserTest()
        {
            //Arrange
            DateTime dt = Convert.ToDateTime(DateTime.Now);

            _generatorContext = new SurveyGeneratorContext();
            _userRepository   = new GenericRepository <User>(_generatorContext);
            _userService      = new UserService(_userRepository);

            User newUser = new User
            {
                AccessLogin = "******",
                CreatedOn   = DateTime.Now,
                Deleted     = false,
                Id          = Guid.NewGuid(),
                FirstName   = "FirstName",
                LastName    = "LastName",
                ModifiedOn  = DateTime.Now,
                Timestamp   = BitConverter.GetBytes(dt.Ticks),
                Email       = "*****@*****.**"
            };

            //Act
            _userService.InsertUser(newUser);

            //Assert
            var user = _userService.GetUserById(newUser.Id);

            Assert.AreEqual(newUser.Id, user.Id);
        }
Example #2
0
        public void DoesUserServiceBringUsers()
        {
            //Arrange
            _generatorContext = new SurveyGeneratorContext();
            _userRepository   = new GenericRepository <User>(_generatorContext);
            _userService      = new UserService(_userRepository);
            //Act
            var users = _userService.GetAllUsers();

            //Assert
            Assert.AreEqual(users.Count(), 0);
        }
Example #3
0
        public void DeleteUserTest()
        {
            //Arrange
            _generatorContext = new SurveyGeneratorContext();
            _userRepository   = new GenericRepository <User>(_generatorContext);
            var users = _userRepository.All();

            //Assert
            _userRepository.Delete(users);

            //Act
            var usersAfterDelete = _userRepository.All();

            Assert.AreEqual(usersAfterDelete.Count(), 0);
        }
Example #4
0
 public UserData(SurveyGeneratorContext generatorContext)
 {
     _generatorContext = generatorContext;
 }