Ejemplo n.º 1
0
        public void ImportSeriesList_EmptyExcel_ShouldReturnEmptySeriesList()
        {
            // Arrange
            using var package = new ExcelPackage();
            var data = new TestExcelData();

            data.CatalogTestsDataList.Clear();
            package.CreateTestsExcel(data);
            using var dataImport = new SpreadsheetDataImport(data.FileName);
            // Act
            var seriesList = dataImport.ImportSeriesListInfo();

            // Assert
            seriesList.Should().BeEmpty();

            package.File.Delete();
        }
Ejemplo n.º 2
0
        public void ImportSeriesList_Duplicates_ShouldReturnSeriesListWithoutDuplicates()
        {
            // Arrange
            using var package = new ExcelPackage();
            var data = new TestExcelData();

            data.CatalogTestsDataList.Add(data.CatalogTestsDataList[0]);
            package.CreateTestsExcel(data);
            using var dataImport = new SpreadsheetDataImport(data.FileName);
            // Act
            var seriesList = dataImport.ImportSeriesListInfo();

            // Assert
            seriesList.Should().HaveCount(data.CatalogTestsDataList.Count - 1);
            seriesList.Should().OnlyHaveUniqueItems();

            package.File.Delete();
        }
Ejemplo n.º 3
0
        public void ImportSeriesList_ShouldReturnSeriesList()
        {
            // Arrange
            using var package = new ExcelPackage();
            var data = new TestExcelData();

            package.CreateTestsExcel(data);
            using var dataImport = new SpreadsheetDataImport(data.FileName);
            // Act
            var seriesList = dataImport.ImportSeriesListInfo();

            // Assert
            seriesList.Should().HaveSameCount(data.CatalogTestsDataList);
            for (int i = 0; i < seriesList.Count; i++)
            {
                var series      = seriesList[i];
                var catalogData = data.CatalogTestsDataList[i];
                series.Id.Should().NotBeEmpty();
                series.SeriesName.Should().Be(catalogData.SeriesName);
                series.VolumeNumber.Should().Be(catalogData.VolumeNumber);
            }

            package.File.Delete();
        }