-
-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Premium License, Datasets, and Extensibility Refactoring (#131)
- Loading branch information
Showing
13 changed files
with
280 additions
and
40 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
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,22 @@ | ||
using System; | ||
|
||
namespace Bogus | ||
{ | ||
/// <summary> | ||
/// General exception for Bogus. | ||
/// </summary> | ||
public class BogusException : Exception | ||
{ | ||
public BogusException() | ||
{ | ||
} | ||
|
||
public BogusException(string message) : base(message) | ||
{ | ||
} | ||
|
||
public BogusException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
} | ||
} |
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
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
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
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,32 @@ | ||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member | ||
|
||
using System; | ||
|
||
namespace Bogus.Premium | ||
{ | ||
public static class ContextHelper | ||
{ | ||
public static T GetOrSet<T>(string key, Faker f, Func<T> factory) where T : DataSet, new() | ||
{ | ||
var context = (f as IHasContext).Context; | ||
|
||
if( context.TryGetValue(key, out var t) ) | ||
{ | ||
return t as T; | ||
} | ||
|
||
var dataset = factory(); | ||
var notifier = (f as IHasRandomizer).GetNotifier(); | ||
notifier.Flow(dataset); | ||
|
||
context[key] = dataset; | ||
return dataset; | ||
} | ||
|
||
public static T GetOrSet<T>(Faker f, Func<T> factory) where T : DataSet, new() | ||
{ | ||
var key = typeof(T).Name.ToLower(); | ||
return GetOrSet($"__{key}", f, factory); | ||
} | ||
} | ||
} |
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 Bogus.Premium | ||
{ | ||
public class License | ||
{ | ||
public static string LicenseTo { get; set; } | ||
public static string LicenseKey { get; set; } | ||
} | ||
} |
Oops, something went wrong.