Ejemplo n.º 1
0
        public static void RunTest()
        {
            Chatroom    newChatroom = new Chatroom();
            Participant john        = new Participant("John");
            Participant max         = new Participant("Max");
            Participant mary        = new Participant("Mary");
            Participant george      = new Participant("George");
            Participant dan         = new Participant("Dan");

            newChatroom.Register(john);
            newChatroom.Register(max);
            newChatroom.Register(mary);
            newChatroom.Register(george);
            newChatroom.Register(dan);

            dan.Send(john, "Hello!");
            john.Send(dan, "What's up?");
            dan.Send(john, "I'm good, and you?");
            john.Send(dan, "I'm good too, thank you.");
            george.Send(mary, "Woof");
            mary.Send(george, "Meow");
            max.Send(dan, "Blah");


            Console.WriteLine();
            newChatroom.PrintChatHistory();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var chatroom = new Chatroom();

            var john   = new Participant("John");
            var james  = new Participant("James");
            var george = new Participant("George");
            var tom    = new ExclusiveParticipant("Tom");

            chatroom.Register(john);
            chatroom.Register(james);
            chatroom.Register(george);
            chatroom.Register(tom);

            john.Send("James", "Hi, James!");
            james.Send("John", "Hi, John!");
            james.Send("Tom", "Hi, Tom!");
            george.Send("Tom", "Hi, Tom!");

            Console.ReadLine();
        }