Skip to content

Commit

Permalink
delete invalid URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ярин Захар Владимирович committed Nov 21, 2023
1 parent 36cf4ea commit 06a8683
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ public void TestSimpleWithEnumerable()
});
}

[Test]
public void TestInvalidUris()
{
var (model, mappingForErrors) = Parse<PriceList>("simpleWithEnumerable_template.xlsx", "simpleWithEnumerable_targetWithInvalidUri.xlsx");

mappingForErrors["Type"].Should().Be("C3");
mappingForErrors["Items[0].Id"].Should().Be("B13");
mappingForErrors["Items[0].Name"].Should().Be("C13");
mappingForErrors["Items[1].Id"].Should().Be("B14");
mappingForErrors["Items[1].Name"].Should().Be("C14");

model.Type.Should().Be("[email protected]>");
model.Items.Should().BeEquivalentTo(new[]
{
new Item {Id = "2311129000009", Name = "СЫР ГОЛЛАНДСКИЙ МОЖГА 1КГ"},
new Item {Id = "2311131000004", Name = "СЫР РОССИЙСКИЙ МОЖГА 1КГ"},
});
}

[Test]
public void TestLazyParse()
{
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public ExcelDocument([NotNull] byte[] template, [NotNull] ILog logger)

documentMemoryStream = new MemoryStream();
documentMemoryStream.Write(template, 0, template.Length);
spreadsheetDocument = SpreadsheetDocument.Open(documentMemoryStream, true);
var settings = new OpenSettings
{
RelationshipErrorHandlerFactory = RelationshipErrorHandler.CreateRewriterFactory((_, _, val) => " ")
};
spreadsheetDocument = SpreadsheetDocument.Open(documentMemoryStream, true, settings);

var theme = GetEmptyTheme();
documentStyle = new ExcelDocumentStyle(spreadsheetDocument.GetOrCreateSpreadsheetStyles(), spreadsheetDocument.WorkbookPart?.ThemePart?.Theme ?? theme, this.logger);
Expand Down

0 comments on commit 06a8683

Please sign in to comment.