Skip to content

Commit

Permalink
StackTrace issue on AppVeyor (#121)
Browse files Browse the repository at this point in the history
* Removed try/catch to see what is wrong with the StackTrace.

* Added FakerTests to regex replace call.

* Added the try/catch back in.

* Commented out the try/catch during PR.
  • Loading branch information
mrstebo authored Mar 9, 2019
2 parents 691eff1 + cefcede commit 1bdc81e
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/FakerDotNet/Fakers/FakeFaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private string GetCalleeFaker()
{
var callee = _stackTraceWrapper.GetClassAtFrame(2) ?? "";

return Regex.Replace(callee, @"Faker$", "");
return Regex.Replace(callee, @"(Faker|FakerTests)$", "");
}

private static IEnumerable<string> GetPlaceholders(string input)
Expand All @@ -61,9 +61,6 @@ private static FakerMatch GetFakerMatch(string calleeFaker, string placeholder,
{
var pattern = Regex.Escape(placeholder);
var match = Regex.Match(input, pattern);

if (!match.Success) return new FakerMatch();

var split = match.Value.Replace("{", "").Replace("}", "").Split('.');
var name = split.Length > 1 ? split[0] : calleeFaker;
var method = split.Length > 1 ? split[1] : split[0];
Expand All @@ -82,8 +79,6 @@ private string Parse(string input, FakerMatch match)
{
try
{
if (!match.Success) return input;

var faker = GetFaker(match.Name);
var value = GetValue(faker, match.Method);
var start = input.Substring(0, match.Index);
Expand Down

0 comments on commit 1bdc81e

Please sign in to comment.