Ejemplo n.º 1
0
 private static void CreateReindersAndMeetSanta()
 {
     for (int i = 0; i < 9; i++)
     {
         ReindeerGroup.Add(new Reindeer(i));
     }
 }
Ejemplo n.º 2
0
        internal void Meet(Reindeer reindeer)
        {
            lock (ReindeerGroup)
            {
                ReindeerGroup.Add(reindeer);

                if (ReindeerGroup.Count == 9)
                {
                    var awakeMessage = new ReindeerAwakeMessage(ReindeerGroup.ToList());

                    foreach (var reindeerToRemove in awakeMessage.Group)
                    {
                        ReindeerGroup.Remove(reindeerToRemove);
                    }

                    Santa.Awake(awakeMessage);
                }
            }
        }