public void Post()
        {
            const string input          = "Bob -> Hello world!";
            var          expectedAuthor = new User("Bob");
            var          expectedTweet  = new Tweet("Hello world!");

            _tokenizerMock.Setup(t => t.Tokenize(input))
            .Returns(new PostTokens(new Post(expectedAuthor, expectedTweet)));
            _twitterminal.Execute(input);

            _tokenizerMock
            .Verify(t => t.Tokenize(input), Times.Once);
            _postHandlerMock
            .Verify(p => p.Post(It.Is <PostTokens>(
                                    pt => pt.GetPost().Author.Username == "Bob" && pt.GetPost().Tweet.Message == "Hello world!")
                                ), Times.Once);
        }
예제 #2
0
        public static void Main(string[] args)
        {
            var tm = new Twitterminal(new Tokenizer(), new PostHandler(new PostRepository(), new UserRepository()));

            tm.Execute("Tony -> Oh my god!");
        }