public void should_assign_edge_case_participants_if_needed()
        {
            BracketGenerator bracket = new BracketGenerator();

            bracket.Participants.Add(new Participant()
            {
                Name = "Joe", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Rob", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Nate", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Stephen", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Justin", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Blake", Seed = null
            });

            bracket.SetBracketOrder();
            Assert.AreEqual(4, bracket.EdgeCaseParticipants.Count);
        }
        public void should_assign_byes_if_needed()
        {
            BracketGenerator bracket = new BracketGenerator();

            bracket.Participants.Add(new Participant()
            {
                Name = "Joe", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Rob", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Nate", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Stephen", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Justin", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Blake", Seed = null
            });
            bracket.Participants.Add(new Participant()
            {
                Name = "Kamika", Seed = null
            });

            bracket.SetBracketOrder();
            Assert.AreEqual(1, bracket.Participants.Count(k => k.Name == "Bye"));
        }
        public void bracket_should_put_seeded_participants_in_correct_order()
        {
            BracketGenerator bracket = new BracketGenerator();

            var           orderedList = new List <Participant>();
            List <string> names       = new List <string>()
            {
                "Rob",
                "Joe",
                "Kamika",
                "Matthew",
                "Stephen",
                "George",
                "Nate",
                "Matt",
                "Jeff",
                "Shayla",
                "Kelly",
                "Stephanie",
                "Blake",
                "Jim",
                "Reid",
                "Jake"
            };

            int count = 0;

            while (count < 16)
            {
                bracket.Participants.Add(new Participant()
                {
                    Name = names[count], Seed = count + 1
                });
                count += 1;
            }

            orderedList.Add(bracket.Participants.ElementAt(14));
            orderedList.Add(bracket.Participants.ElementAt(1));
            orderedList.Add(bracket.Participants.ElementAt(9));
            orderedList.Add(bracket.Participants.ElementAt(6));
            orderedList.Add(bracket.Participants.ElementAt(13));
            orderedList.Add(bracket.Participants.ElementAt(2));
            orderedList.Add(bracket.Participants.ElementAt(10));
            orderedList.Add(bracket.Participants.ElementAt(5));
            orderedList.Add(bracket.Participants.ElementAt(12));
            orderedList.Add(bracket.Participants.ElementAt(3));
            orderedList.Add(bracket.Participants.ElementAt(11));
            orderedList.Add(bracket.Participants.ElementAt(4));
            orderedList.Add(bracket.Participants.ElementAt(8));
            orderedList.Add(bracket.Participants.ElementAt(7));
            orderedList.Add(bracket.Participants.ElementAt(15));
            orderedList.Add(bracket.Participants.ElementAt(0));

            bracket.SetBracketOrder();
            count = bracket.ParticipantsInBracketOrder.Count;
            var orderedStack = new Stack <Participant>(orderedList);

            Assert.AreEqual(orderedStack.Count, bracket.ParticipantsInBracketOrder.Count);
            Assert.AreEqual(orderedStack.ElementAt(4), bracket.ParticipantsInBracketOrder.ElementAt(4));
            Assert.AreEqual(orderedStack.ElementAt(0), bracket.ParticipantsInBracketOrder.ElementAt(0));
            Assert.AreEqual(orderedStack.ElementAt(count - 1), bracket.ParticipantsInBracketOrder.ElementAt(count - 1));
        }