Beispiel #1
0
        public bool CreateMember(Member member)
        {
            BillMember(member);
            member.Memberships.Add(GetMembership());

            MemberRepo.SaveMember(member);
            return(true);
        }
Beispiel #2
0
        public void PlayTournament()
        {
            // Arrange
            const string cupName  = "Bengans Cup";
            const string expected = "John Doe";

            var manager = TestHelper.CreateTournamentManager();
            var members = TestHelper.SeedMembers();

            manager.CreateTournament(cupName, DateTime.Now.AddYears(-1),
                                     DateTime.Now.AddDays(-60).AddYears(-1));


            foreach (var member in members)
            {
                manager.AddContestant(member, cupName);
                MemberRepo.SaveMember(member);
            }

            // Act
            for (int i = 0; i < members.Count; i++)
            {
                for (int j = i + 1; j < members.Count; j++)
                {
                    TestHelper.PlayTournamentGame(new List <Member> {
                        members[i], members[j]
                    }, cupName);
                }
            }
            var winner = manager.GetTournamentResult(cupName).Winner;

            // Assert
            Assert.IsNotNull(winner);
            string actual = winner.FirstName + " " + winner.Lastname;

            Assert.AreEqual(expected, actual);
        }
Beispiel #3
0
 private bool SaveMember(Member member)
 {
     Console.WriteLine("Saving member");
     return(MemberRepo.SaveMember(member));
 }