public void Publish_message_should_be_called()
        {
            _sut = new CommandHandler(userList, publish, reading, follow, wall);

            _sut.SelectAction("-> message", "Alice");

            publish.Received().PublishMessage("-> message", "Alice");
        }
        public void Must_follow_a_user()
        {
            _sut = new CommandHandler(userList, publish, reading, follow, wall);

            _sut.SelectAction("follow Mahmut", "Alice");

            follow.Received().FollowUser("Alice", "Mahmut");
        }
        public void Must_show_all_messages()
        {
            wall.DisplayAllMessages("Alice").Returns(new List<Message>()
                                           {
                                               new Message()
                                               {
                                                   UsersMessage = "test"
                                               }
                                           });

            _sut = new CommandHandler(userList, publish, reading, follow, wall);

            _sut.SelectAction("wall", "Alice");

            wall.Received().DisplayAllMessages("Alice");
        }
예제 #4
0
        public static void Main()
        {
            Console.WriteLine(">");
            Console.Write("Enter username: "******"Enter command: ");
                Console.Write(userName + " ");
                var command = Console.ReadLine();

                var commandHandler = new CommandHandler(userList, publish, reading, follow, wall);

                commandHandler.SelectAction(command, userName);
            }
        }
        public void Must_be_able_to_see_own_messages()
        {
            reading.GetMessages("Mahmut").Returns(new List<Message>()
                                           {
                                               new Message()
                                               {
                                                   UsersMessage = "test",
                                                   messageDate = DateTime.Now
                                               },
                                               new Message()
                                               {
                                                   UsersMessage = "omg work! ... please"
                                               }
                                           });

            _sut = new CommandHandler(userList, publish, reading, follow, wall);

            _sut.SelectAction("my messages", "Mahmut");

            reading.Received().GetMessages("Mahmut");
        }