public User NewUser(string name) { ulong id = this.NextId(); User user = new User(id, name); this.repository.SetUser(user); return user; }
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); } }
public void RaiseWhenNameIsNull() { User user = new User(1, null); }
public void RaiseWhenNameIsEmpty() { User user = new User(1, ""); }
public void RaiseWhenIdIsZero() { User user = new User(0, "foo"); }
public void SetUser(User user) { users[user.Id] = user; }
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); }