We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6df4fbc commit 71afe85Copy full SHA for 71afe85
test/UnitTest/Extensions/ObjectExtensionsTest.cs
@@ -318,6 +318,11 @@ public void CreateInstance_Ok()
318
319
// 接口类型不报错
320
Assert.Null(ObjectExtensions.CreateInstance<MockInterface>(true));
321
+
322
+ var bar = ObjectExtensions.CreateInstance<MockObject>(true);
323
+ Assert.NotNull(bar);
324
+ Assert.NotNull(bar.Foo);
325
+ Assert.Null(bar.Bar);
326
}
327
328
private interface MockInterface
@@ -332,6 +337,15 @@ private class MockComplexObject
332
337
public (string Name, int Count)[]? Test { get; set; }
333
338
334
339
340
+ private class MockObject
341
+ {
342
+ public string? Name { get; set; }
343
344
+ public Foo? Foo { get; set; }
345
346
+ public Foo? Bar { get; }
347
+ }
348
335
349
private class MockStatic
336
350
{
351
private static int _test;
0 commit comments