diff --git a/src/.nuget/NuGet.targets b/src/.nuget/NuGet.targets index 02efc58..0a43b9c 100644 --- a/src/.nuget/NuGet.targets +++ b/src/.nuget/NuGet.targets @@ -21,7 +21,7 @@ $(TargetDir.Trim('\\')) - "http://dev-nugetgal01.bvops.com/ThirdPartyLibraries/api/v1" + "https://nuget.org/api/v2/" false diff --git a/src/Fluency.Tests/DataGeneration/ARandomSpecs.cs b/src/Fluency.Tests/DataGeneration/ARandomSpecs.cs index 0d2aa24..a50dfad 100644 --- a/src/Fluency.Tests/DataGeneration/ARandomSpecs.cs +++ b/src/Fluency.Tests/DataGeneration/ARandomSpecs.cs @@ -66,7 +66,6 @@ [ Subject( typeof ( ARandom ), "Int" ) ] public class When_generating_a_random_integer { It should_generate_a_integer = () => ARandom.Int().should_be_an_instance_of< Int32 >(); - It should_generate_a_positive_nonzero_number = () => ARandom.Int().should_be_greater_than( 0 ); } diff --git a/src/Fluency.Tests/Utils/NumericalExtensionsSpecs.cs b/src/Fluency.Tests/Utils/NumericalExtensionsSpecs.cs index 7b07d11..b5ee0dd 100644 --- a/src/Fluency.Tests/Utils/NumericalExtensionsSpecs.cs +++ b/src/Fluency.Tests/Utils/NumericalExtensionsSpecs.cs @@ -19,7 +19,7 @@ public class When_repeating_a_function_5_times_using_the_of_extension private Because of = () => results = 5.Of( () => ARandom.Int() ); private It should_return_5_elements = () => results.Count().ShouldEqual( 5 ); - private It should_return_all_integers = () => results.ShouldEachConformTo( item => item > 0 ); + private It should_return_all_integers = () => results.ShouldEachConformTo( item => item >= int.MinValue && item <= int.MaxValue ); } } } diff --git a/src/Fluency/DataGeneration/ARandom.cs b/src/Fluency/DataGeneration/ARandom.cs index 93a8fa9..f47e4ab 100644 --- a/src/Fluency/DataGeneration/ARandom.cs +++ b/src/Fluency/DataGeneration/ARandom.cs @@ -43,8 +43,18 @@ public static string String( int size ) { var builder = new StringBuilder(); for ( var i = 0; i < size; i++ ) - //26 letters in the alfabet, ascii + 65 for the capital letters - builder.Append( Convert.ToChar( Convert.ToInt32( Math.Floor( 26 * Random.NextDouble() + 65 ) ) ) ); + { + var isUpper = IntBetween(1, 2) == 1; + if (isUpper) + { + //26 letters in the alphabet, ascii + 65 for the capital letters + builder.Append( Convert.ToChar( Convert.ToInt32( Math.Floor( 26 * Random.NextDouble() + 65 ) ) ) ); + } + else + { + builder.Append(Convert.ToChar(Convert.ToInt32(Math.Floor(26 * Random.NextDouble() + 97)))); + } + } return builder.ToString(); } @@ -155,16 +165,15 @@ private static string GetRandomizedPatternChar( char c ) /// - /// Returns a random between 1 and 9999. + /// Returns a random between int.MinValue and int.MaxValue. /// /// - /// I think this code was tampered with. I believe it used to include the full range of int - /// including negative values. Not sure. + /// returns a random int /// /// public static int Int() { - return IntBetween( 1, 9999 ); + return IntBetween( int.MinValue, int.MaxValue ); } @@ -172,12 +181,12 @@ public static int Int() // TODO: Byte??? /// - /// Returns a random positive between 1 and 9999. + /// Returns a random positive between 1 and int.MaxValue. /// /// public static int PositiveInt() { - return IntBetween( 1, 9999 ); + return IntBetween( 1, int.MaxValue ); }