public void Init() { _standardOut = new StringWriter (); Console.SetOut (_standardOut); User user = new User ("mcarmen"); user.Post ("Message", DateTime.Now.AddSeconds(-30)); User otherUser = new User ("rob"); User anotherUser = new User ("arthur"); anotherUser.Post ("1 Message", DateTime.Now.AddSeconds(-30)); anotherUser.Post ("2 Message", DateTime.Now.AddSeconds(-20)); _userRepositoryMock = new Mock<IUserRepository> (); _userRepositoryMock.Setup (x => x.GetUser (user.Name)).Returns (user); _userRepositoryMock.Setup (x => x.GetUser (otherUser.Name)).Returns (otherUser); _userRepositoryMock.Setup (x => x.GetUser (anotherUser.Name)).Returns (anotherUser); _readController = new ReadActionController (_userRepositoryMock.Object); }
public void Init() { _standardOut = new StringWriter (); Console.SetOut (_standardOut); User user = new User ("mcarmen"); User anotherUser = new User ("arthur"); anotherUser.Post("First message", DateTime.Now.AddSeconds(-30)); User followingUser = new User ("rob"); followingUser.Post("First message from following user", DateTime.Now.AddSeconds(-20)); anotherUser.Follow(followingUser); _userRepositoryMock = new Mock<IUserRepository> (); _userRepositoryMock.Setup (x => x.GetUser (user.Name)).Returns (user); _userRepositoryMock.Setup (x => x.GetUser (anotherUser.Name)).Returns (anotherUser); _userRepositoryMock.Setup (x => x.GetUser (followingUser.Name)).Returns (followingUser); _wallController = new WallActionController (_userRepositoryMock.Object); }
public void NewMessageShouldBeAddedToMessageListWhenPosting() { User user = new User ("mcarmen"); user.Post ("Hello"); Assert.AreEqual (1, user.Messages.Count); }