feat(FakerExtensions.cs): add FakerExtensions class with UsePrivateConstructor method

This commit is contained in:
Jean Gatto
2023-08-27 16:24:26 -03:00
parent 1a53d6b33a
commit 75ffe1863b
@@ -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);
}