示例#1
0
        public void Testing_of_Single_Play_strong_weak()
        {
            var simulator = new SimulatorHandler(null);
            var first     = new FootballTeam()
            {
                AttackStrength        = 1,
                CollaboratingStrength = 1,
                DefenceStrength       = 1
            };

            var second = new FootballTeam()
            {
                AttackStrength        = 10,
                CollaboratingStrength = 10,
                DefenceStrength       = 10
            };


            var comp = new Competition()
            {
                FirstTeam  = first,
                SecondTeam = second
            };

            simulator.Play(comp);
        }
示例#2
0
        public void Testing_Summarize_Championship()
        {
            var context = GetContext();

            var simulator = new SimulatorHandler(context);
            //get last championship
            var champ = context.SimulatorData <Championship>()
                        .Include(el => el.Competitions)
                        .OrderByDescending(el => el.Year).FirstOrDefault();

            if (champ != null)
            {
                var allResults = simulator.Summarize(champ);
            }
        }
示例#3
0
        public void Testing_first_team_results()
        {
            var context = GetContext();

            var simulator = new SimulatorHandler(context);
            //get last championship
            var champ = context.SimulatorData <Championship>()
                        .Include(el => el.Competitions)
                        .OrderByDescending(el => el.Year).FirstOrDefault();

            if (champ != null)
            {
                var team = champ.Competitions.FirstOrDefault()? .FirstTeam;
                if (team != null)
                {
                    var result = simulator.SummariseTeamResult(champ, team);
                }
            }
        }
示例#4
0
        public void Testing_of_Calculate_Championship_results()
        {
            var context = GetContext();

            var simulator = new SimulatorHandler(context);
            //get last championship
            var          last = context.SimulatorData <Championship>().OrderByDescending(el => el.Year).FirstOrDefault();
            Championship champ;

            if (last == null || last.Completed)
            {
                var year = last == null ? DateTime.Now.Year : last.Year + 1;
                champ = simulator.CreateChampionship($"Championship {year}", year);
            }
            else
            {
                champ = last;
            }
            simulator.FinalizeChampionship(champ);
        }
示例#5
0
        public void Create_New_Chanpionship_with_competitions()
        {
            var context = GetContext();

            var simulator = new SimulatorHandler(context);

            simulator.CreateChampionship("Test", 9999);

            var comps = context.SimulatorData <Competition>().Where(cmp => cmp.Championship.Year == 9999);
            var count = comps.Count();

            Assert.IsNotNull(count == 6);

            context.Delete <Competition>(comps.ToList());

            var champship = context.SimulatorData <Championship>()
                            .FirstOrDefault(el => el.Caption == "Test");

            context.Delete(champship);
            context.Save();
        }
示例#6
0
 void Start()
 {
     main = this;
     Debug.Break();
     EditorApplication.pauseStateChanged += OnPause;
 }