File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
Tynamix.ObjectFiller.Test/BugfixTests Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change
1
+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
2
+ using System ;
3
+ using System . Collections . Generic ;
4
+ using System . Linq ;
5
+ using System . Text ;
6
+ using System . Threading . Tasks ;
7
+
8
+ #if NET6_0_OR_GREATER
9
+ namespace Tynamix . ObjectFiller . Test . BugfixTests
10
+ {
11
+ public record Product
12
+ {
13
+ public string Name { get ; init ; }
14
+ public int CategoryId { get ; set ; }
15
+ }
16
+
17
+ public record Person ( string Name , string Username ) ;
18
+
19
+ [ TestClass ]
20
+ public class Bug136RecordsObjectReferenceException
21
+ {
22
+ [ TestMethod ]
23
+ public void RecordsShouldBeFilled ( )
24
+ {
25
+ Filler < Product > filler = new Filler < Product > ( ) ;
26
+ var product = filler . Create ( ) ;
27
+ Assert . IsNotNull ( product ) ;
28
+ Assert . IsFalse ( string . IsNullOrWhiteSpace ( product . Name ) ) ;
29
+
30
+ var filler2 = new Filler < Person > ( ) ;
31
+ var person = filler2 . Create ( ) ;
32
+ Assert . IsNotNull ( person ) ;
33
+ Assert . IsFalse ( string . IsNullOrWhiteSpace ( person . Name ) ) ;
34
+ Assert . IsFalse ( string . IsNullOrWhiteSpace ( person . Username ) ) ;
35
+ }
36
+ }
37
+ }
38
+ #endif
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ internal static IEnumerable<MethodInfo> GetMethods(this Type source)
37
37
internal static MethodInfo GetSetterMethod ( this PropertyInfo source )
38
38
{
39
39
#if NETSTANDARD
40
- return source . SetMethod ;
40
+ return source ? . SetMethod ;
41
41
#else
42
42
return source . GetSetMethod ( true ) ;
43
43
#endif
You can’t perform that action at this time.
0 commit comments