feat(FakerExtensions.cs): add FakerExtensions class with UsePrivateConstructor method
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using Bogus;
|
||||
|
||||
namespace Shop.IntegrationTests.Extensions;
|
||||
|
||||
internal static class FakerExtensions
|
||||
{
|
||||
public static Faker<T> UsePrivateConstructor<T>(this Faker<T> faker) where T : class =>
|
||||
faker.CustomInstantiator(_ => Activator.CreateInstance(typeof(T), nonPublic: true) as T);
|
||||
}
|
||||
Reference in New Issue
Block a user