Exemple #1
0
        public async Task Get_CurrentCsv_Returns_NotFound()
        {
            //Arrange
            PurgeBrokenExternalReferencesReportTable();

            //Act
            using (var response = await BrokenExternalReferencesReportHelper.SendGetCurrentCsvAsync())
            {
                //Assert
                Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
            }
        }
Exemple #2
0
        private static async Task <Dictionary <string, List <LinkReportCsvFormat> > > GetBrokenLinksReportAsync()
        {
            using (var response = await BrokenExternalReferencesReportHelper.SendGetCurrentCsvAsync())
            {
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                using (var csvReader = new CsvReader(new StringReader(await response.Content.ReadAsStringAsync()),
                                                     new CsvConfiguration(CultureInfo.InvariantCulture)
                {
                    Delimiter = ";",
                    HasHeaderRecord = true
                }))
                {
                    var result = new Dictionary <string, List <LinkReportCsvFormat> >();

                    foreach (var parentGroup in csvReader.GetRecords <LinkReportCsvFormat>().GroupBy(record => record.Navn))
                    {
                        result[parentGroup.Key] = new List <LinkReportCsvFormat>(parentGroup);
                    }

                    return(result);
                }
            }
        }