Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/.nuget/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<PackageSources>"http://dev-nugetgal01.bvops.com/ThirdPartyLibraries/api/v1"</PackageSources>
<PackageSources>"https://nuget.org/api/v2/"</PackageSources>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
Expand Down
1 change: 0 additions & 1 deletion src/Fluency.Tests/DataGeneration/ARandomSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}


Expand Down
2 changes: 1 addition & 1 deletion src/Fluency.Tests/Utils/NumericalExtensionsSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}
25 changes: 17 additions & 8 deletions src/Fluency/DataGeneration/ARandom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -155,29 +165,28 @@ private static string GetRandomizedPatternChar( char c )


/// <summary>
/// Returns a random <see cref="integer"/> between 1 and 9999.
/// Returns a random <see cref="integer"/> between int.MinValue and int.MaxValue.
/// </summary>
/// <remarks>
/// 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
/// </remarks>
/// <returns></returns>
public static int Int()
{
return IntBetween( 1, 9999 );
return IntBetween( int.MinValue, int.MaxValue );
}


// TODO: Decimal???
// TODO: Byte???

/// <summary>
/// Returns a random positive <see cref="integer"/> between 1 and 9999.
/// Returns a random positive <see cref="integer"/> between 1 and int.MaxValue.
/// </summary>
/// <returns></returns>
public static int PositiveInt()
{
return IntBetween( 1, 9999 );
return IntBetween( 1, int.MaxValue );
}


Expand Down