public void Year_Champion_Not_Enough_Matches_Test()
        {
            var resultManager = ResultManager.Instance();
            var memberFactory = new MemberFactory(400);
            var member1       = memberFactory.CreateMember("Test", "Test street 1", true);
            var member2       = memberFactory.CreateMember("tester", "tester street 55", true);
            var matchDirector = new MatchDirector();
            var matchBuilder  = new MatchBuilder(100);

            for (var i = 0; i < 9; i++)
            {
                matchDirector.Construct(matchBuilder, member1, member2);
                matchBuilder.GetResult().SetPlayerOneScore(50, 50, 50);
                matchBuilder.GetResult().SetPlayerTwoScore(100, 100, 100);
            }

            Assert.Null(resultManager.GetYearChampion(DateTime.Now));
        }
예제 #2
0
        public void  Match_Draw_Test()
        {
            var memberFactory = new MemberFactory(400);
            var member1       = memberFactory.CreateMember("Test", "Test street 1", true);
            var member2       = memberFactory.CreateMember("tester", "tester street 55", true);
            var matchDirector = new MatchDirector();
            var matchBuilder  = new MatchBuilder(100);

            matchDirector.Construct(matchBuilder, member1, member2);
            var testMatch = matchBuilder.GetResult();

            testMatch.SetPlayerOneScore(100, 100, 100);
            testMatch.SetPlayerTwoScore(100, 100, 100);

            Assert.Null(testMatch.GetWinner());
            Assert.Null(testMatch.GetLoser());
        }
예제 #3
0
        static void Main(string[] args)
        {
            var memberFactory = new MemberFactory(400);

            for (var i = 0; i < 11; i++)
            {
                memberFactory.CreateMember("TestMember" + i, "Test Street" + i, true);
            }

            var competitionFactory = new CompetitionFactory();
            var testCompetition    = competitionFactory.CreateCompetition("Test Competition", DateTime.Now, DateTime.Now.AddDays(7), 150);


            var matchDirector           = new MatchDirector();
            var testCupGameMatchBuilder = new CompetitionMatchBuilder(testCompetition, 100);

            Console.WriteLine("Competition games");
            for (var j = 0; j < 11; j++)
            {
                for (var i = j + 1; i < 11; i++)
                {
                    var player   = ResultManager.Instance().Members[j];
                    var opponent = ResultManager.Instance().Members[i];

                    matchDirector.Construct(testCupGameMatchBuilder, player, opponent);
                    testCupGameMatchBuilder.GetResult().GeneratePlayerScores();
                }
            }


            Console.WriteLine();
            Console.WriteLine("Champion playing games...");
            var champ = memberFactory.CreateMember("Winner", "Winner Street", true);
            var loser = memberFactory.CreateMember("Loser", "Loser Street", true);

            var standaloneMatchBuilder = new MatchBuilder(100);

            for (var i = 0; i < 12; i++)
            {
                matchDirector.Construct(standaloneMatchBuilder, champ, loser);
                var testMatch = standaloneMatchBuilder.GetResult();
                testMatch.SetPlayerOneScore(100, 100, 100);
                testMatch.SetPlayerTwoScore(50, 50, 50);
            }


            var resultManager = ResultManager.Instance();

            resultManager.GetCompetitionResults(testCompetition);
            resultManager.GetYearChampion(DateTime.Now);


            Console.WriteLine();
            Console.WriteLine("----------");
            var fortKnox = FortKnox.Instance();

            fortKnox.ExportInvoices();

            Console.WriteLine("Press any key...");
            Console.ReadLine();
        }