File tree Expand file tree Collapse file tree 5 files changed +22
-7
lines changed
Tynamix.ObjectFiller.Test Expand file tree Collapse file tree 5 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public void Returns_Https_When_Set()
4242 [ TestMethod ]
4343 public void Returns_Configured_Domain_When_Set ( )
4444 {
45- var sut = new RandomUri ( RandomUri . SchemeType . Https , new [ ] { "net" } ) ;
45+ var sut = new RandomUri ( RandomUri . SchemeType . Https , "net" ) ;
4646 var value = sut . GetValue ( ) ;
4747 Assert . IsNotNull ( value ) ;
4848
@@ -56,7 +56,7 @@ internal class UriTestClass
5656 }
5757
5858 [ TestMethod ]
59- public void TestUriGenerator ( )
59+ public void Set_Value_With_Filler_With_Setup ( )
6060 {
6161 Filler < UriTestClass > filler = new Filler < UriTestClass > ( ) ;
6262
@@ -69,5 +69,18 @@ public void TestUriGenerator()
6969
7070 Assert . IsFalse ( string . IsNullOrEmpty ( url ) ) ;
7171 }
72+
73+
74+ [ TestMethod ]
75+ public void Set_Value_With_Filler_Without_Setup ( )
76+ {
77+ Filler < UriTestClass > filler = new Filler < UriTestClass > ( ) ;
78+
79+ var result = filler . Create ( ) ;
80+
81+ var url = result . RemoteUri . ToString ( ) ;
82+
83+ Assert . IsFalse ( string . IsNullOrEmpty ( url ) ) ;
84+ }
7285 }
7386}
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public void Returns_Https_When_Set()
4646 [ TestMethod ]
4747 public void Returns_Configured_Domain_When_Set ( )
4848 {
49- var sut = new RandomUrl ( RandomUri . SchemeType . Https , new [ ] { "net" } ) ;
49+ var sut = new RandomUrl ( RandomUri . SchemeType . Https , "net" ) ;
5050 var value = sut . GetValue ( ) ;
5151 Assert . IsNotNull ( value ) ;
5252
@@ -61,7 +61,7 @@ internal class UriTestClass
6161 }
6262
6363 [ TestMethod ]
64- public void TestUrlGenerator ( )
64+ public void Set_Value_With_Filler_With_Setup ( )
6565 {
6666 Filler < UriTestClass > filler = new Filler < UriTestClass > ( ) ;
6767
Original file line number Diff line number Diff line change @@ -55,10 +55,10 @@ public RandomUri(SchemeType schemeType)
5555 /// </summary>
5656 /// <param name="schemeType">Type of the scheme.</param>
5757 /// <param name="domainNames">The possible domain names.</param>
58- public RandomUri ( SchemeType schemeType , IEnumerable < string > domainNames )
58+ public RandomUri ( SchemeType schemeType , params string [ ] domainNames )
5959 : this ( schemeType )
6060 {
61- _domainNames = domainNames . ToArray ( ) ;
61+ _domainNames = domainNames ;
6262 }
6363
6464 /// <summary>
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public RandomUrl(SchemeType schemeType)
3434 /// </summary>
3535 /// <param name="schemeType">Type of the scheme.</param>
3636 /// <param name="domainNames">The possible domain names.</param>
37- public RandomUrl ( SchemeType schemeType , IEnumerable < string > domainNames )
37+ public RandomUrl ( SchemeType schemeType , params string [ ] domainNames )
3838 {
3939 _uri = new RandomUri ( schemeType , domainNames ) ;
4040 }
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ private void SetDefaultRandomizer()
121121 var mnemonic = new MnemonicString ( 1 ) ;
122122 var doublePlugin = new DoubleRange ( ) ;
123123 var dateTimeRandomizer = new DateTimeRange ( new DateTime ( 1970 , 1 , 1 ) ) ;
124+ var uriRandomizer = new RandomUri ( ) ;
124125 this . TypeToRandomFunc [ typeof ( string ) ] = mnemonic . GetValue ;
125126 this . TypeToRandomFunc [ typeof ( bool ) ] = ( ) => Random . Next ( 0 , 2 ) == 1 ;
126127 this . TypeToRandomFunc [ typeof ( bool ? ) ] = ( ) => new RandomListItem < bool ? > ( true , false , null ) . GetValue ( ) ;
@@ -154,6 +155,7 @@ private void SetDefaultRandomizer()
154155 this . TypeToRandomFunc [ typeof ( IntPtr ? ) ] = ( ) => default ( IntPtr ) ;
155156 this . TypeToRandomFunc [ typeof ( TimeSpan ) ] = ( ) => new TimeSpan ( Random . Next ( ) ) ;
156157 this . TypeToRandomFunc [ typeof ( TimeSpan ? ) ] = ( ) => new TimeSpan ( Random . Next ( ) ) ;
158+ this . TypeToRandomFunc [ typeof ( Uri ) ] = ( ) => uriRandomizer . GetValue ( ) ;
157159#if ! NETSTANDARD1_0
158160 this . TypeToRandomFunc [ typeof ( ArrayList ) ] = ( ) => ( ( IRandomizerPlugin < ArrayList > ) new Collectionizer < string , MnemonicString > ( ) ) . GetValue ( ) ;
159161#endif
You can’t perform that action at this time.
0 commit comments