You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running unit tests using Random.RandomLocale(), so I want to test all of them
What is the expected behavior?
Not to have en_AU_ocker popping in my tests, as it throws an error when creating a new System.Globalization.CultureInfo
What is the actual behavior?
When I run my tests (until failure), the locale en_AU_ocker pops out and make my tests fail.
Please provide a stack trace.
System.Globalization.CultureNotFoundException : Culture is not supported. (Parameter 'name')
en_AU_ocker is an invalid culture identifier.
at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
at Domain.Tests.Tests.<>c.b__6_13(Faker f) in /Users/taarybr1/Developer/Swisscom/Gitlab/bws/dispatch/Matrona/tests/Domain.Tests/Tenant.cs:line 53
at Bogus.Faker1.<>c__DisplayClass34_01.b__0(Faker f, T t)
at Bogus.Faker1.PopulateProperty(T instance, PopulateAction1 action)
at Bogus.Faker1.PopulateInternal(T instance, String[] ruleSets) at Bogus.Faker1.Generate(String ruleSets)
at Domain.Tests.Tests.Dummy() in /Users/taarybr1/Developer/Swisscom/Gitlab/bws/dispatch/Matrona/tests/Domain.Tests/Tenant.cs:line 97
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Any possible solutions?
I created an extension to filter the locale out:
public static class Extension
{
public static string RandomLocale(this Randomizer randomizer, bool excludeOcker = false)
{
var result = randomizer.RandomLocale();
if (!excludeOcker) return result;
while (Equals(result, "en_AU_ocker"))
{
result = randomizer.RandomLocale();
}
return result;
}
}
How do you reproduce the issue?
Running tests until failure when using Randomizer Faker.Random.RandomLocale
Do you have a unit test that can demonstrate the bug?
Using NUnit
[Test]
public void DamnOcker()
{
Assert.DoesNotThrow(() =>
{
var dummy = new CultureInfo(_testFaker.Random.RandomLocale());
});
}
Can you identify the location in Bogus' source code where the problem exists?
I'm not sure
If the bug is confirmed, would you be willing to submit a PR?
I'm affraid it's too much for me... 😱
The text was updated successfully, but these errors were encountered:
Version Information
What locale are you using with Bogus?
I'm running unit tests using Random.RandomLocale(), so I want to test all of them
What is the expected behavior?
Not to have en_AU_ocker popping in my tests, as it throws an error when creating a new System.Globalization.CultureInfo
What is the actual behavior?
When I run my tests (until failure), the locale en_AU_ocker pops out and make my tests fail.
Please provide a stack trace.
Any possible solutions?
I created an extension to filter the locale out:
How do you reproduce the issue?
Running tests until failure when using Randomizer Faker.Random.RandomLocale
Do you have a unit test that can demonstrate the bug?
Using NUnit
Can you identify the location in Bogus' source code where the problem exists?
I'm not sure
If the bug is confirmed, would you be willing to submit a PR?
I'm affraid it's too much for me... 😱
The text was updated successfully, but these errors were encountered: