File tree Expand file tree Collapse file tree 4 files changed +36
-4
lines changed
test/JSSoft.Randora.Tests Expand file tree Collapse file tree 4 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 44 pull_request :
55 push :
66 branches :
7- - dev
7+ - main
8+
89 workflow_dispatch :
910
1011env :
Original file line number Diff line number Diff line change 33// Licensed under the MIT License. See LICENSE.md in the project root for license information.
44// </copyright>
55
6- #pragma warning disable MEN002 // Line is too long
7-
86namespace JSSoft . Randora ;
97
108public static partial class RandomUtility
Original file line number Diff line number Diff line change 33// Licensed under the MIT License. See LICENSE.md in the project root for license information.
44// </copyright>
55
6- #pragma warning disable MEN002 // Line is too long
76#pragma warning disable SA1414 // Tuple types in signatures should have element names
87namespace JSSoft . Randora ;
98
Original file line number Diff line number Diff line change @@ -988,4 +988,38 @@ public void NullableValueTuple_Ints_WithRandom_Basic()
988988 Assert . IsType < DateTime > ( t8 . Value . Rest . Item1 ) ;
989989 }
990990 }
991+
992+ // Generic helpers ----------------------------------------------------
993+
994+ [ Fact ]
995+ public void Nullable_Int_WithRandom_ShouldContainNullAndValue ( )
996+ {
997+ var r = NewSeeded ( ) ;
998+ const int iterations = 128 ; // 66% 값 생성 확률을 고려한 충분한 반복
999+ var results = new List < int ? > ( capacity : iterations ) ;
1000+
1001+ for ( int i = 0 ; i < iterations ; i ++ )
1002+ {
1003+ results . Add ( R . Nullable ( r , R . Int32 ) ) ;
1004+ }
1005+
1006+ Assert . Contains ( results , v => v . HasValue ) ;
1007+ Assert . Contains ( results , v => v is null ) ;
1008+ }
1009+
1010+ [ Fact ]
1011+ public void NullableObject_String_WithRandom_ShouldContainNullAndValue ( )
1012+ {
1013+ var r = NewSeeded ( ) ;
1014+ const int iterations = 128 ;
1015+ var results = new List < string ? > ( capacity : iterations ) ;
1016+
1017+ for ( int i = 0 ; i < iterations ; i ++ )
1018+ {
1019+ results . Add ( R . NullableObject ( r , R . String ) ) ;
1020+ }
1021+
1022+ Assert . Contains ( results , v => v is not null ) ;
1023+ Assert . Contains ( results , v => v is null ) ;
1024+ }
9911025}
You can’t perform that action at this time.
0 commit comments