File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
test/DocumentFormat.OpenXml.Tests/ofapiTest Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -240,5 +240,43 @@ public void GetOrAddFirstChildTest()
240240 var r2 = p . GetOrAddFirstChild < Run > ( ) ;
241241 Assert . Same ( r , r2 ) ;
242242 }
243+
244+ [ Fact ]
245+ public void IsValidChild_ValidChild_ReturnsTrue ( )
246+ {
247+ // Arrange
248+ var parentElement = new Paragraph ( ) ;
249+ var validChild = new Run ( ) ;
250+
251+ // Act
252+ var result = parentElement . IsValidChild ( validChild ) ;
253+
254+ // Assert
255+ Assert . True ( result ) ;
256+ }
257+
258+ [ Fact ]
259+ public void IsValidChild_InvalidChild_ReturnsFalse ( )
260+ {
261+ // Arrange
262+ var parentElement = new Paragraph ( ) ;
263+ var invalidChild = new Table ( ) ;
264+
265+ // Act
266+ var result = parentElement . IsValidChild ( invalidChild ) ;
267+
268+ // Assert
269+ Assert . False ( result ) ;
270+ }
271+
272+ [ Fact ]
273+ public void IsValidChild_NullChild_ThrowsArgumentNullException ( )
274+ {
275+ // Arrange
276+ var parentElement = new Paragraph ( ) ;
277+
278+ // Act & Assert
279+ Assert . Throws < ArgumentNullException > ( ( ) => parentElement . IsValidChild ( null ) ) ;
280+ }
243281 }
244282}
You can’t perform that action at this time.
0 commit comments