forked from ddrilling/AsbCloudServer
88ce24b8bb
1. Создание инфраструктуры для интегарционных тестов 2. Покрытие контроллера месторождений тестами
25 lines
712 B
C#
25 lines
712 B
C#
using AsbCloudDb.Model;
|
|
using Bogus;
|
|
|
|
namespace AsbCloudWebApi.IntegrationTests.TestFakers;
|
|
|
|
public static class DepositTestFaker
|
|
{
|
|
public static Deposit GetDeposit() =>
|
|
GetDepositFaker().Generate();
|
|
|
|
public static IEnumerable<Deposit> GetDeposits(int count) =>
|
|
GetDepositFaker().Generate(count);
|
|
|
|
private static Faker<Deposit> GetDepositFaker() =>
|
|
new Faker<Deposit>()
|
|
.RuleFor(d => d.Id, 0)
|
|
.RuleFor(d => d.Caption, f => f.Random.String2(1, 50))
|
|
.RuleFor(d => d.Latitude, f => f.Random.Int(-90, 90))
|
|
.RuleFor(d => d.Longitude, f => f.Random.Int(-180, 180))
|
|
.RuleFor(d => d.Timezone, f => new SimpleTimezone
|
|
{
|
|
Hours = f.Random.Int(1, 12),
|
|
IsOverride = f.Random.Bool()
|
|
});
|
|
} |