Beispiel #1
0
        public void CallsThePrintFormatter()
        {
            var user = new User("Alice");
            var post = new Post(user, "Hello!", DateTime.Now);
            user.Publish(post);
            var spy = new PostFormatterSpy();
            var oSpy = new OutputSpy();
            var command = new PrintPosts(spy, oSpy);

            command.Execute(user);

            Assert.Equal(new[] { post }, spy.CalledWith);
        }
Beispiel #2
0
        public void FormatsPosts()
        {
            var alice = new User("Alice");
            var bob = new User("Bob");
            var post = new Post(bob, "Hello, World!", DateTime.Now);

            alice.Follow(bob);
            bob.Publish(post);

            var outputSpy = new OutputSpy();
            var postFormatter = new PostFormatterSpy();

            var command = new PrintWall(postFormatter, outputSpy);
            command.Execute(alice);

            Assert.Equal(new[] { post }, postFormatter.CalledWith);
        }