Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2115 error when importing empty row #2384

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/OSPSuite.Infrastructure.Import/Core/DataSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ public void RemoveEmptyRows()
{
if (_rawDataTable[i].All(x => x.IsNullOrEmpty()))
_rawDataTable.RemoveAt(i);
else
break;
}
}

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using FakeItEasy;
using OSPSuite.BDDHelper;
Expand All @@ -12,6 +13,7 @@
using OSPSuite.Core.Services;
using OSPSuite.Helpers;
using OSPSuite.Infrastructure.Import.Core;
using OSPSuite.Infrastructure.Import.Core.DataSourceFileReaders;
using OSPSuite.Infrastructure.Import.Core.Exceptions;
using OSPSuite.Infrastructure.Import.Core.Mappers;
using OSPSuite.Infrastructure.Import.Services;
Expand Down Expand Up @@ -208,6 +210,31 @@ public void sets_column_mapping_presenter_settings()
}
}

public class When_setting_data_source_with_empty_rows : concern_for_ImporterPresenter
{
protected Cache<string, DataSheet> _sheets;

protected override void Context()
{
base.Context();
_sheets = new Cache<string, DataSheet>();
_sheets.Add("Sheet1", A.Fake<DataSheet>());

_dataSourceFile = new ExcelDataSourceFile(A.Fake<IImportLogger>());
_dataSourceFile.Format = A.Fake<IDataFormat>();
_dataSourceFile.Path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "IntegrationSampleUnitFromColumn.xlsx");
A.CallTo(() => _importerDataPresenter.SetDataSource(A<string>.Ignored)).Returns(_dataSourceFile);
_importerDataPresenter.OnImportSheets += Raise.With(new ImportSheetsEventArgs()
{ Filter = "", DataSourceFile = _dataSourceFile, SheetNames = _sheets.Keys.ToList() });
}

[Observation]
public void should_not_throw_an_ImporterParsingException()
{
sut.LoadConfiguration(_importerConfiguration, "");
}
}

public class When_import_data : concern_for_ImporterPresenter
{
protected bool triggered = false;
Expand Down