Example #1
0
 public User NewUser(string name)
 {
     ulong id = this.NextId();
     User user = new User(id, name);
     this.repository.SetUser(user);
     return user;
 }
Example #2
0
        public void CreateUser()
        {
            User user = new User(1, "foo");

            Assert.AreEqual(1u, user.Id);
            Assert.AreEqual("foo", user.Name);
        }
 public void AddLastUser()
 {
     UserRepository repository = new UserRepository();
     User user = new User(ulong.MaxValue, "last");
     repository.SetUser(user);
     User result = repository.GetUser(user.Id);
     Assert.IsNotNull(result);
     Assert.AreEqual(user, result);
 }
        public void Setup()
        {
            this.userrepository = new UserRepository();
            this.msgrepository = new MessageRepository();
            this.service = new ActivityService(this.msgrepository, this.userrepository);

            UserService uservice = new UserService(this.userrepository);
            this.user = uservice.NewUser("user");

            for (int k = 1; k <= 100; k++)
            {
                User follower = uservice.NewUser("follower" + k);
                uservice.AddFollower(this.user.Id, follower.Id);
                this.followers.Add(follower);
            }
        }
        public void AddOneThousandUsers()
        {
            UserRepository repository = new UserRepository();

            for (ushort k = 1; k <= 1000; k++)
            {
                User user = new User(k, "user" + k);
                repository.SetUser(user);
            }

            for (ushort k = 1; k <= 1000; k++)
            {
                User result = repository.GetUser(k);
                Assert.IsNotNull(result);
                Assert.AreEqual((ulong)k, result.Id);
                Assert.AreEqual("user" + k, result.Name);
            }
        }
Example #6
0
 public void RaiseWhenNameIsNull()
 {
     User user = new User(1, null);
 }
Example #7
0
 public void RaiseWhenNameIsEmpty()
 {
     User user = new User(1, "");
 }
Example #8
0
 public void RaiseWhenIdIsZero()
 {
     User user = new User(0, "foo");
 }
Example #9
0
 public void SetUser(User user)
 {
     users[user.Id] = user;
 }
Example #10
0
 public void AddUserOne()
 {
     UserRepository repository = new UserRepository();
     User user = new User(1, "one");
     repository.SetUser(user);
     User result = repository.GetUser(user.Id);
     Assert.IsNotNull(result);
     Assert.AreEqual(user, result);
 }