Exemple #1
0
        public void UsernameWallPrintsWall()
        {
            var alice = new User("Alice");
            var retriever = new StubUserRetriever(alice);

            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", "wall" });

            Assert.Equal(alice, wSpy.LastCalledWith);
        }
Exemple #2
0
        public void UsernameArrowMessagePublishesMessage()
        {
            var alice = new User("Alice");
            var retriever = new StubUserRetriever(alice);

            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", "->", "Hello,", "World!" });

            Assert.Equal(alice, pSpy.UserCalledWith);
            Assert.Equal("Hello, World!", pSpy.MessageCalledWith);
        }