public void RetrievesUserByName() { var repo = new UserRepository(); var alice = new User("Alice"); repo.Add(alice); Assert.Equal(alice, repo.Get("Alice")); }
public void UsernameFollowUsernameFollowsUser() { var alice = new User("Alice"); var bob = new User("Bob"); var repo = new UserRepository(); repo.Add(alice); repo.Add(bob); var retriever = new CreateOrRetrieveUserByName(repo); var spy = new PrintPostsSpy(); var pSpy = new PublishPostSpy(); var fSpy = new FollowUserSpy(); var wSpy = new PrintWallSpy(); var dispatcher = new CommandDispatcher(retriever, spy, pSpy, fSpy, wSpy); dispatcher.Run(new[] { "Alice", "follows", "Bob" }); Assert.Equal(alice, fSpy.UserCalledWith); Assert.Equal(bob, fSpy.UserToFollowCalledWith); }