Esempio n. 1
0
        public async Task UnableToFindMinimumTempSpreadWhenNoDays()
        {
            var sut = new SeasonResultService(_mockFileParser.Object, _mockLoggingService.Object);

            var result = await sut.GetSeasonResultWithSmallestPointDifferential();

            Assert.Equal(SeasonResult.EmptySeasonResult, result);
        }
Esempio n. 2
0
        public async Task FindsMinimumGoalDifferentialSingleResult()
        {
            var result1 = new SeasonResult("abc", 2, 10);

            _seasonResultData.Add(result1);

            var sut = new SeasonResultService(_mockFileParser.Object, _mockLoggingService.Object);

            var result = await sut.GetSeasonResultWithSmallestPointDifferential();

            Assert.Equal(result1.Team, result.Team);
        }
Esempio n. 3
0
        public async Task FindsMinimumGoalDifferentialAmongManyResults()
        {
            var result1 = new SeasonResult("abc", 2, 10);
            var result2 = new SeasonResult("def", 4, 7);
            var result3 = new SeasonResult("ghi", 11, 13);
            var result4 = new SeasonResult("jkl", 5, 6);


            _seasonResultData.AddRange(new SeasonResult[] { result1, result2, result3, result4 });

            var sut = new SeasonResultService(_mockFileParser.Object, _mockLoggingService.Object);

            var result = await sut.GetSeasonResultWithSmallestPointDifferential();

            Assert.Equal(result4.Team, result.Team);
        }
Esempio n. 4
0
        public static async Task Main()
        {
            BuildDependencies();

            // For a real world application, we would want this file path configurable.
            // For now, this file is added to the project and copied to the output
            // directory for simplicity.

            var seasonResultService = new SeasonResultService(_seasonResultFileParser, _loggingService);

            var smallestDifferntialResult = await seasonResultService.GetSeasonResultWithSmallestPointDifferential().ConfigureAwait(false);

            if ((SeasonResult)smallestDifferntialResult != SeasonResult.EmptySeasonResult)
            {
                Console.Out.WriteLine($"Team with smallest point differential: {smallestDifferntialResult.Team}");
            }
            else
            {
                Console.Out.WriteLine("Unable to determine team with smallest point differential. See logs.");
            }
            Console.In.ReadLine();
        }