83 instantiations of ExtractionDocumentTableCell
Microsoft.Extensions.DocumentExtraction.Abstractions.Tests (2)
DocumentExtractionDocumentBuilderTests.cs (2)
121
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(content);
153
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(new ExtractionDocumentTextElement(new TextContent("replacement")));
Microsoft.Extensions.Documents.Abstractions.Tests (81)
DocumentReferencesTests.cs (1)
366
ExtractionDocumentTableCell cell =
new
();
DocumentReviewFollowUpTests.cs (6)
24
Assert.IsType<List<ExtractionDocumentSourceReference>>(new
ExtractionDocumentTableCell
().Sources);
124
outer.Cells[0, 0] =
new
(inner);
125
outer.Cells[0, 1] =
new
(inner);
126
inner.Cells[0, 0] =
new
(shared);
135
inner.Cells[0, 0] =
new
(outer);
149
ExtractionDocumentTableCell cell =
new
(text);
DocumentTableCellCollectionTests.cs (25)
21
table.Cells[0, 1] = new
ExtractionDocumentTableCell
(firstContent);
22
table.Cells[1, 2] = new
ExtractionDocumentTableCell
(lastContent);
48
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(content);
68
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(image);
89
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(oldContent);
92
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(replacementContent);
113
ExtractionDocumentTableCell cell =
new
(content);
163
ExtractionDocumentTableCell cell =
new
(mixed, 2, 2, "rowHeader");
259
ExtractionDocumentTableCell cell =
new
(mixed);
270
innerTable.Cells[0, 0] = new
ExtractionDocumentTableCell
(root);
303
Assert.Throws<InvalidOperationException>(() => table.Cells[0, 0] = new
ExtractionDocumentTableCell
(table));
314
outerTable.Cells[0, 0] = new
ExtractionDocumentTableCell
(innerTable);
316
innerTable.Cells[0, 0] = new
ExtractionDocumentTableCell
(outerTable);
337
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(content);
358
ExtractionDocumentTableCell anchor =
new
(new ExtractionDocumentTextElement(new TextContent("MERGED_A")), 2, 2, "header");
359
ExtractionDocumentTableCell ordinary =
new
(new ExtractionDocumentTextElement(new TextContent("B")));
391
ExtractionDocumentTableCell anchor =
new
(text, 2, 2);
396
ExtractionDocumentTableCell overlap =
new
(2, 1);
397
ExtractionDocumentTableCell candidate =
new
();
426
ExtractionDocumentTableCell candidate =
new
(rowSpan, columnSpan);
440
ExtractionDocumentTableCell anchor =
new
(anchorText, 2, 2);
447
ExtractionDocumentTableCell candidate =
new
(candidateText, 2, 1);
508
ExtractionDocumentTableCell oldAnchor =
new
(oldText, 2, 2, "rowHeader");
519
ExtractionDocumentTableCell replacement =
new
(replacementText);
535
ExtractionDocumentTableCell empty =
new
();
DocumentTableCellTests.cs (12)
21
table.Cells[1, 0] = new
ExtractionDocumentTableCell
(content);
40
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(content);
63
() => new
ExtractionDocumentTableCell
(null!));
79
ExtractionDocumentTableCell content =
new
(text, role: role);
80
ExtractionDocumentTableCell empty =
new
(role: role);
107
Assert.Throws<ArgumentException>(nameof(role), () => new
ExtractionDocumentTableCell
(text, role: role));
108
Assert.Throws<ArgumentException>(nameof(role), () => new
ExtractionDocumentTableCell
(role: role));
118
ExtractionDocumentTableCell empty =
new
();
148
Assert.Throws<ArgumentOutOfRangeException>(parameter, () => new
ExtractionDocumentTableCell
(rowSpan, columnSpan));
149
Assert.Throws<ArgumentOutOfRangeException>(parameter, () => new
ExtractionDocumentTableCell
(text, rowSpan, columnSpan));
165
ExtractionDocumentTableCell empty =
new
();
169
ExtractionDocumentTableCell ordinary =
new
(text);
DocumentTableElementTests.cs (28)
21
inner.Cells[0, 0] = new
ExtractionDocumentTableCell
(leaf);
22
middle.Cells[0, 0] = new
ExtractionDocumentTableCell
(inner);
23
outer.Cells[0, 0] = new
ExtractionDocumentTableCell
(middle);
40
ExtractionDocumentTableCell first =
new
(text, role: "vendor|\"<");
42
inner.Cells[0, 1] = new
ExtractionDocumentTableCell
(image);
44
outer.Cells[0, 0] = new
ExtractionDocumentTableCell
(inner);
62
ExtractionDocumentTableCell wide =
new
(new ExtractionDocumentTextElement(new TextContent("wide")), 2, 3);
63
ExtractionDocumentTableCell corner =
new
(new ExtractionDocumentTextElement(new TextContent("corner")), role: "rowHeader");
68
Assert.Throws<InvalidOperationException>(() => table.Cells[1, 1] = new
ExtractionDocumentTableCell
());
69
Assert.Throws<InvalidOperationException>(() => table.Cells[0, 3] = new
ExtractionDocumentTableCell
(3, 1));
70
Assert.Throws<ArgumentException>(() => table.Cells[0, 0] = new
ExtractionDocumentTableCell
(4, 1));
73
ExtractionDocumentTableCell small =
new
(new ExtractionDocumentTextElement(new TextContent("small")));
145
ExtractionDocumentTableCell candidate =
new
(text);
167
table.Cells[0, 1] = new
ExtractionDocumentTableCell
(new ExtractionDocumentTextElement(new TextContent("one")));
168
table.Cells[1, 0] = new
ExtractionDocumentTableCell
(new ExtractionDocumentTextElement(new TextContent("two")));
183
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(new ExtractionDocumentTextElement(new TextContent("left|right")));
192
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(new ExtractionDocumentTextElement(new TextContent("semantic cell")));
202
ExtractionDocumentTableCell anchor =
new
(new ExtractionDocumentTextElement(new TextContent("MERGED_A<&")), 2, 2, "columnHeader");
204
table.Cells[2, 0] = new
ExtractionDocumentTableCell
(new ExtractionDocumentTextElement(new TextContent("B")), role: "rowHeader");
205
ExtractionDocumentTableCell empty =
new
(role: "vendor\"role");
236
ExtractionDocumentTableCell cell =
new
(text, role: role);
258
ExtractionDocumentTableCell empty =
new
();
260
ExtractionDocumentTableCell anchor =
new
(text, rowSpan, columnSpan);
303
ExtractionDocumentTableCell empty =
new
();
309
table.Cells[0, 2] = new
ExtractionDocumentTableCell
(text);
366
ExtractionDocumentTableCell empty =
new
();
390
ExtractionDocumentTableCell populated =
new
(text);
391
ExtractionDocumentTableCell empty =
new
();
DocumentTests.Composition.cs (4)
31
ExtractionDocumentTableCell empty =
new
();
34
table.Cells[0, 1] = new
ExtractionDocumentTableCell
(cellText);
91
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(cellText);
92
table.Cells[0, 1] = new
ExtractionDocumentTableCell
();
DocumentTests.StandardContent.cs (5)
135
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(cellContent);
170
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(cellText);
220
table.Cells[0, 0] = new
ExtractionDocumentTableCell
(text);
400
ExtractionDocumentTableCell firstCell =
new
(first);
403
table.Cells[0, 1] = new
ExtractionDocumentTableCell
(second);
87 references to ExtractionDocumentTableCell
Microsoft.Extensions.Documents.Abstractions (16)
ExtractionDocumentTable.cs (16)
47
/// Initializes a new instance of the <see cref="
ExtractionDocumentTableCell
"/> class.
61
/// <summary>Initializes a new instance of the <see cref="
ExtractionDocumentTableCell
"/> class without content.</summary>
125
public sealed class ExtractionDocumentTableCellCollection : IEnumerable<
ExtractionDocumentTableCell
?>
128
private readonly
ExtractionDocumentTableCell
?[,] _cells;
129
private readonly
ExtractionDocumentTableCell
?[,] _coveringCells;
134
_cells = new
ExtractionDocumentTableCell
?[rowCount, columnCount];
135
_coveringCells = new
ExtractionDocumentTableCell
?[rowCount, columnCount];
157
public
ExtractionDocumentTableCell
? this[int row, int column]
173
ExtractionDocumentTableCell
? oldCell = _cells[row, column];
202
internal
ExtractionDocumentTableCell
? GetCoveringCell(int row, int column)
214
public IEnumerator<
ExtractionDocumentTableCell
?> GetEnumerator()
227
private void ValidateCanAdd(
ExtractionDocumentTableCell
cell)
240
private void ValidateSpan(int row, int column,
ExtractionDocumentTableCell
cell,
ExtractionDocumentTableCell
? replaced)
267
private void SetCoverage(
ExtractionDocumentTableCell
cell,
ExtractionDocumentTableCell
? covering)
Microsoft.Extensions.Documents.Abstractions.Tests (71)
DocumentReferencesTests.cs (9)
24
foreach (Type type in new[] { typeof(ExtractionDocument), typeof(ExtractionDocumentElement), typeof(
ExtractionDocumentTableCell
) })
34
foreach (Type type in new[] { typeof(ExtractionDocumentElement), typeof(
ExtractionDocumentTableCell
) })
56
Assert.Null(typeof(
ExtractionDocumentTableCell
).GetProperty("Kind"));
57
Assert.Null(typeof(
ExtractionDocumentTableCell
).GetProperty("CellKind"));
58
Assert.Equal(typeof(string), typeof(
ExtractionDocumentTableCell
).GetProperty("Role")!.PropertyType);
59
Assert.False(typeof(
ExtractionDocumentTableCell
).GetProperty("Role")!.CanWrite);
61
Assert.Equal(typeof(
ExtractionDocumentTableCell
), indexer.PropertyType);
64
Assert.All(typeof(
ExtractionDocumentTableCell
).GetConstructors(), constructor =>
366
ExtractionDocumentTableCell
cell = new();
DocumentReviewFollowUpTests.cs (1)
149
ExtractionDocumentTableCell
cell = new(text);
DocumentTableCellCollectionTests.cs (25)
24
ExtractionDocumentTableCell
?[] cells = table.Cells.ToArray();
34
new
ExtractionDocumentTableCell
?[] { null, cells[1], null, null, null, cells[5] },
50
ExtractionDocumentTableCell
cell = table.Cells[0, 0]!;
90
ExtractionDocumentTableCell
oldCell = table.Cells[0, 0]!;
94
ExtractionDocumentTableCell
replacementCell = table.Cells[0, 0]!;
113
ExtractionDocumentTableCell
cell = new(content);
163
ExtractionDocumentTableCell
cell = new(mixed, 2, 2, "rowHeader");
259
ExtractionDocumentTableCell
cell = new(mixed);
338
ExtractionDocumentTableCell
cell = table.Cells[0, 0]!;
358
ExtractionDocumentTableCell
anchor = new(new ExtractionDocumentTextElement(new TextContent("MERGED_A")), 2, 2, "header");
359
ExtractionDocumentTableCell
ordinary = new(new ExtractionDocumentTextElement(new TextContent("B")));
379
Assert.Equal(new
ExtractionDocumentTableCell
?[] { anchor, null, null, null, null, null, ordinary, null, null }, table.Cells.ToArray());
391
ExtractionDocumentTableCell
anchor = new(text, 2, 2);
395
ExtractionDocumentTableCell
?[] before = table.Cells.ToArray();
396
ExtractionDocumentTableCell
overlap = new(2, 1);
397
ExtractionDocumentTableCell
candidate = new();
426
ExtractionDocumentTableCell
candidate = new(rowSpan, columnSpan);
440
ExtractionDocumentTableCell
anchor = new(anchorText, 2, 2);
447
ExtractionDocumentTableCell
candidate = new(candidateText, 2, 1);
448
ExtractionDocumentTableCell
?[] before = table.Cells.ToArray();
508
ExtractionDocumentTableCell
oldAnchor = new(oldText, 2, 2, "rowHeader");
519
ExtractionDocumentTableCell
replacement = new(replacementText);
535
ExtractionDocumentTableCell
empty = new();
555
ExtractionDocumentTableCell
? covering = null;
575
new
ExtractionDocumentTableCell
?[]
DocumentTableCellTests.cs (8)
25
ExtractionDocumentTableCell
cell = table.Cells[1, 0]!;
45
ExtractionDocumentTableCell
cell = table.Cells[0, 0]!;
79
ExtractionDocumentTableCell
content = new(text, role: role);
80
ExtractionDocumentTableCell
empty = new(role: role);
92
Assert.Equal(new
ExtractionDocumentTableCell
?[] { content, empty }, table.Cells);
118
ExtractionDocumentTableCell
empty = new();
165
ExtractionDocumentTableCell
empty = new();
169
ExtractionDocumentTableCell
ordinary = new(text);
DocumentTableElementTests.cs (26)
40
ExtractionDocumentTableCell
first = new(text, role: "vendor|\"<");
62
ExtractionDocumentTableCell
wide = new(new ExtractionDocumentTextElement(new TextContent("wide")), 2, 3);
63
ExtractionDocumentTableCell
corner = new(new ExtractionDocumentTextElement(new TextContent("corner")), role: "rowHeader");
73
ExtractionDocumentTableCell
small = new(new ExtractionDocumentTextElement(new TextContent("small")));
81
void AssertCoverage(
ExtractionDocumentTableCell
? anchor, int rows, int columns)
88
ExtractionDocumentTableCell
? cornerCell = row == 2 && column == 3 ? corner : null;
89
ExtractionDocumentTableCell
? expected = inSpan ? anchor : cornerCell;
109
new
ExtractionDocumentTableCell
?[] { null, null, null, null, null, null },
145
ExtractionDocumentTableCell
candidate = new(text);
159
new
ExtractionDocumentTableCell
?[] { null, null, null, null },
202
ExtractionDocumentTableCell
anchor = new(new ExtractionDocumentTextElement(new TextContent("MERGED_A<&")), 2, 2, "columnHeader");
205
ExtractionDocumentTableCell
empty = new(role: "vendor\"role");
207
ExtractionDocumentTableCell
?[] before = table.Cells.ToArray();
236
ExtractionDocumentTableCell
cell = new(text, role: role);
258
ExtractionDocumentTableCell
empty = new();
260
ExtractionDocumentTableCell
anchor = new(text, rowSpan, columnSpan);
275
new
ExtractionDocumentTableCell
?[] { empty, null, null, null, null, anchor, null, null, null, null, null, null },
282
ExtractionDocumentTableCell
? covering = inSpan ? anchor : null;
303
ExtractionDocumentTableCell
empty = new();
348
Assert.Equal(new
ExtractionDocumentTableCell
?[] { null, null, null, null }, table.Cells.ToArray());
355
Assert.Equal(new
ExtractionDocumentTableCell
?[] { null, null, null, null }, table.Cells.ToArray());
366
ExtractionDocumentTableCell
empty = new();
374
Assert.Equal(new
ExtractionDocumentTableCell
?[] { null, null, null, empty }, table.Cells.ToArray());
390
ExtractionDocumentTableCell
populated = new(text);
391
ExtractionDocumentTableCell
empty = new();
407
Assert.Equal(new
ExtractionDocumentTableCell
?[] { null, null, null, null }, table.Cells.ToArray());
DocumentTests.Composition.cs (1)
31
ExtractionDocumentTableCell
empty = new();
DocumentTests.StandardContent.cs (1)
400
ExtractionDocumentTableCell
firstCell = new(first);