-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* IBAN * Regex * fix postcode * 1.0.6.0 * 1.0.5.0
- Loading branch information
Showing
28 changed files
with
2,432 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2,108 changes: 2,108 additions & 0 deletions
2,108
src/RandomDataGenerator/Compatibility/ConcurrentDictionary.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copied from https://raw.githubusercontent.com/SaladLab/NetLegacySupport/master/core/ConcurrentDictionary/System/Collections/Concurrent/FrameworkTraits.cs | ||
#if NET20 || NET35 | ||
using System; | ||
using System.Threading; | ||
|
||
namespace RandomDataGenerator.Compatibility | ||
{ | ||
internal static class Volatile | ||
{ | ||
public static T Read<T>(ref T location) where T : class | ||
{ | ||
// | ||
// The VM will replace this with a more efficient implementation. | ||
// | ||
var value = location; | ||
Thread.MemoryBarrier(); | ||
return value; | ||
} | ||
|
||
public static void Write<T>(ref T location, T value) where T : class | ||
{ | ||
// | ||
// The VM will replace this with a more efficient implementation. | ||
// | ||
Thread.MemoryBarrier(); | ||
location = value; | ||
} | ||
} | ||
|
||
internal static class PlatformHelper | ||
{ | ||
public static int ProcessorCount | ||
{ | ||
get { return Environment.ProcessorCount; } | ||
} | ||
} | ||
|
||
internal static class Monitor | ||
{ | ||
public static void Enter(Object obj, ref bool lockTaken) | ||
{ | ||
if (lockTaken) | ||
throw new ArgumentException("Argument must be initialized to false", "lockTaken"); | ||
|
||
System.Threading.Monitor.Enter(obj); | ||
lockTaken = true; | ||
} | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Fare; | ||
|
||
namespace RandomDataGenerator.TextData.Models | ||
{ | ||
internal class IBAN | ||
{ | ||
public string CountryName { get; set; } | ||
|
||
public string CountryCode { get; set; } | ||
|
||
public Xeger Generator { get; set; } | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Albania AL ^AL\d{10}[0-9A-Z]{16}$ | ||
Andorra AD ^AD\d{10}[0-9A-Z]{12}$ | ||
Austria AT ^AT\d{18}$ | ||
Kingdom of Bahrain BH ^BH\d{2}[A-Z]{4}[0-9A-Z]{14}$ | ||
Belgium BE ^BE\d{14}$ | ||
Bosnia and Herzegovina BA ^BA\d{18}$ | ||
Bulgaria BG ^BG\d{2}[A-Z]{4}\d{6}[0-9A-Z]{8}$ | ||
Croatia HR ^HR\d{19}$ | ||
Cyprus CY ^CY\d{10}[0-9A-Z]{16}$ | ||
Czech Republic CZ ^CZ\d{22}$ | ||
Denmark DK ^DK\d{16}$|^FO\d{16}$|^GL\d{16}$ | ||
Dominican Republic DO ^DO\d{2}[0-9A-Z]{4}\d{20}$ | ||
Estonia EE ^EE\d{18}$ | ||
Finland FI ^FI\d{16}$ | ||
France FR ^FR\d{12}[0-9A-Z]{11}\d{2}$ | ||
Georgia GE ^GE\d{2}[A-Z]{2}\d{16}$ | ||
Germany DE ^DE\d{20}$ | ||
Gibraltar GI ^GI\d{2}[A-Z]{4}[0-9A-Z]{15}$ | ||
Greece GR ^GR\d{9}[0-9A-Z]{16}$ | ||
Hungary HU ^HU\d{26}$ | ||
Iceland IS ^IS\d{24}$ | ||
Ireland IE ^IE\d{2}[A-Z]{4}\d{14}$ | ||
Israel IL ^IL\d{21}$ | ||
Italy IT ^IT\d{2}[A-Z]\d{10}[0-9A-Z]{12}$ | ||
Kazakhstan KZ ^[A-Z]{2}\d{5}[0-9A-Z]{13}$ | ||
KUWAIT KW ^KW\d{2}[A-Z]{4}22!$ | ||
Latvia LV ^LV\d{2}[A-Z]{4}[0-9A-Z]{13}$ | ||
LEBANON LB ^LB\d{6}[0-9A-Z]{20}$ | ||
Liechtenstein (Principality of) LI ^LI\d{7}[0-9A-Z]{12}$ | ||
Lithuania LT ^LT\d{18}$ | ||
Luxembourg LU ^LU\d{5}[0-9A-Z]{13}$ | ||
Macedonia MK ^MK\d{5}[0-9A-Z]{10}\d{2}$ | ||
Malta MT ^MT\d{2}[A-Z]{4}\d{5}[0-9A-Z]{18}$ | ||
Mauritania MR ^MR13\d{23}$ | ||
Mauritius MU ^MU\d{2}[A-Z]{4}\d{19}[A-Z]{3}$ | ||
Monaco MC ^MC\d{12}[0-9A-Z]{11}\d{2}$ | ||
Montenegro ME ^ME\d{20}$ | ||
The Netherlands NL ^NL\d{2}[A-Z]{4}\d{10}$ | ||
Norway NO ^NO\d{13}$ | ||
Poland PL ^PL\d{10}[0-9A-Z]{16}$ | ||
Portugal PT ^PT\d{23}$ | ||
Romania RO ^RO\d{2}[A-Z]{4}[0-9A-Z]{16}$ | ||
San Marino SM ^SM\d{2}[A-Z]\d{10}[0-9A-Z]{12}$ | ||
Saudi Arabia SA ^SA\d{4}[0-9A-Z]{18}$ | ||
Serbia RS ^RS\d{20}$ | ||
Slovak Republic SK ^SK\d{22}$ | ||
Slovenia SI ^SI\d{17}$ | ||
Spain ES ^ES\d{22}$ | ||
Sweden SE ^SE\d{22}$ | ||
Switzerland CH ^CH\d{7}[0-9A-Z]{12}$ | ||
Tunisia TN ^TN59\d{20}$ | ||
Turkey TR ^TR\d{7}[0-9A-Z]{17}$ | ||
United Arab Emirates AE ^AE\d{21}$ | ||
United Kingdom GB ^GB\d{2}[A-Z]{4}\d{14}$ |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
| ||
namespace RandomDataGenerator.FieldOptions | ||
{ | ||
public class FieldOptionsIBAN : FieldOptionsAbstract, IFieldOptionsString | ||
{ | ||
public string CountryCode { get; set; } | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
src/RandomDataGenerator/FieldOptions/FieldOptionsTextPattern.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/RandomDataGenerator/FieldOptions/FieldOptionsTextRegex.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace RandomDataGenerator.FieldOptions | ||
{ | ||
public class FieldOptionsTextRegex : FieldOptionsAbstract, IFieldOptionsString | ||
{ | ||
/// <summary> | ||
/// Use any valid Regex pattern to generate a string. | ||
/// </summary> | ||
public string Pattern { get; set; } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/RandomDataGenerator/Generators/RandomItemFromListGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace RandomDataGenerator.Generators | ||
{ | ||
internal class RandomItemFromListGenerator<T> | ||
{ | ||
private readonly T[] _list; | ||
|
||
public RandomItemFromListGenerator(IEnumerable<T> list, Func<T, bool> predicate = null) | ||
{ | ||
_list = predicate == null ? list.ToArray() : list.Where(predicate).ToArray(); | ||
} | ||
|
||
public T Generate() | ||
{ | ||
return _list.Length > 0 ? _list[RandomValueGenerator.Next(0, _list.Length)] : default(T); | ||
} | ||
} | ||
} |
13 changes: 2 additions & 11 deletions
13
src/RandomDataGenerator/Generators/RandomStringFromListGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,11 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace RandomDataGenerator.Generators | ||
{ | ||
internal class RandomStringFromListGenerator | ||
internal class RandomStringFromListGenerator : RandomItemFromListGenerator<string> | ||
{ | ||
private readonly string[] _list; | ||
|
||
public RandomStringFromListGenerator(IEnumerable<string> list) | ||
{ | ||
_list = list.ToArray(); | ||
} | ||
|
||
public string Generate() | ||
public RandomStringFromListGenerator(IEnumerable<string> list) : base(list) | ||
{ | ||
return _list.Length > 0 ? _list[RandomValueGenerator.Next(0, _list.Length)] : string.Empty; | ||
} | ||
} | ||
} |
Oops, something went wrong.