public async Task Given_DataFile_When_Reporting_Then_ProduceJsonReport()
        {
            // Arrange
            var datafile           = Path.Combine(AppContext.BaseDirectory, "Data", "chicago-bulls.csv");
            var expectedReportFile = Path.Combine(AppContext.BaseDirectory, "Data", "chicago-bulls.json");
            var originalReport     = await File.ReadAllTextAsync(expectedReportFile);

            var reportObject   = JsonConvert.DeserializeObject(originalReport);
            var expectedReport = JsonConvert.SerializeObject(reportObject, Formatting.Indented);

            var playerParser    = new PlayerParser();
            var dataProvider    = new CsvDataProvider(playerParser);
            var metricConverter = new ImperialToMetricConverter();
            var enrichers       = new List <IReportEnricher>
            {
                new AveragePlayerHeightEnricher(metricConverter),
                new AveragePointsForTeamEnricher(),
                new TeamEnricher(),
                new TopAchieversEnricher()
            };

            var statisticsReporter = new TeamStatisticsReporter(enrichers);

            var sut = new TeamStatisticsJsonReporter(dataProvider, statisticsReporter);

            // Act
            var result = await sut.GetReportAsJsonAsync(datafile);

            // Assert
            Assert.Equal(expectedReport, result);
        }
        public void Given_PlayersData_When_ReportRequested_Then_ReturnReportWithTeamStatistics()
        {
            // Arrange
            var enricher1 = Substitute.For <IReportEnricher>();
            var enricher2 = Substitute.For <IReportEnricher>();

            var sut = new TeamStatisticsReporter(new List <IReportEnricher>
            {
                enricher1,
                enricher2
            });

            var players = new List <Player> {
            };

            enricher1.EnrichReport(Arg.Any <IEnumerable <Player> >(), Arg.Any <IReportBuilder>())
            .Returns(ci => ci.Arg <IReportBuilder>());

            enricher2.EnrichReport(Arg.Any <IEnumerable <Player> >(), Arg.Any <IReportBuilder>())
            .Returns(ci => ci.Arg <IReportBuilder>());

            // Act
            var result = sut.GetReport(players);

            // Assert
            Assert.NotNull(result);
            Received.InOrder(() =>
            {
                enricher1
                .Received(1)
                .EnrichReport(Arg.Is <IEnumerable <Player> >(p => p.Equals(players)),
                              Arg.Any <IReportBuilder>());

                enricher2
                .Received(1)
                .EnrichReport(Arg.Is <IEnumerable <Player> >(p => p.Equals(players)),
                              Arg.Any <IReportBuilder>());
            });
        }