Example #1
0
        public void TestTeamWinPercentage_GivenWith_TeamData_ShouldBe_ManyTeamValuesAndSortedDescendingByTeamWinsPercentage()
        {
            sut = new F1Stats(SampleData.Teams, new F1StatsWeightingStub());

            var resultCollection = sut.TeamWinPercentage();

            double highest = 0, current = 0;

            foreach (TeamValue team in resultCollection)
            {
                if (highest == 0)
                {
                    highest = team.TeamWinsPercentage;
                }

                current = team.TeamWinsPercentage;

                if (highest != current)
                {
                    Assert.IsTrue(highest > current);
                }

                highest = current;
            }
        }
Example #2
0
        public void TestTeamWinPercentage_GivenWith_TeamDataAndTeam5_ShouldBe_1TeamValueWithDriverWinPercentage()
        {
            sut = new F1Stats(SampleData.Teams, new F1StatsWeightingStub());

            var resultCollection = sut.TeamWinPercentage(5);

            Assert.IsTrue(((List <TeamValue>)resultCollection)[0].DriverWinPercentage > 0);
        }
Example #3
0
        public void TestTeamWinPercentage_GivenWith_TeamDataAndTeam5_ShouldBe_1TeamValue()
        {
            sut = new F1Stats(SampleData.Teams, new F1StatsWeightingStub());

            var resultCollection = sut.TeamWinPercentage(5);

            Assert.AreEqual(resultCollection.Count(), 1);
        }
Example #4
0
        public void TestTeamWinPercentage_GivenWith_TeamDataAndTeam9999_ShouldBe_EmptyList()
        {
            sut = new F1Stats(SampleData.Teams, new F1StatsWeightingStub());

            var resultCollection = sut.TeamWinPercentage(9999);

            Assert.IsEmpty(resultCollection);
        }
Example #5
0
        public void TestTeamWinPercentage_GivenWith_TeamData_ShouldBe_ManyTeamValues()
        {
            sut = new F1Stats(SampleData.Teams, new F1StatsWeightingStub());

            var resultCollection = sut.TeamWinPercentage();

            Assert.IsTrue(resultCollection.Count() > 1);
        }
Example #6
0
        public void TestTeamWinPercentageEmptyList()
        {
            var value = f1stats.TeamWinPercentage(-1);

            if (value != null && value.Count() == 0)
            {
                // pass
            }
            else
            {
                throw new Exception("TestTeamWinPercentageEmptyList() failed");
            }
        }