public static List <ISale> GetSales(string customerId, int?number = 3) { var faker = new Faker <Sale>(); faker.RuleFor(x => x.Products, ServiceMocks.GetProducts(3).ToList()); faker.RuleFor(x => x.CreatedDate, x => x.Date.Past()); faker.RuleFor(x => x.SaleDate, x => x.Date.Past()); faker.RuleFor(x => x.CustomerId, x => Guid.Parse(customerId)); return(faker.Generate(number.GetValueOrDefault(3)).Cast <ISale>().ToList()); }
public static ICustomer GetCustomer(string customerId) { Random rnd = new Random(); if (rnd.Next(0, 1) == 0) { return(ServiceMocks.GetCompanyies(1).First()); } else { return(ServiceMocks.GetPersons(1).First()); } }
public static ICustomer[] GetCompanyies(int?number = 3) { var faker = new Faker <Organization>(); faker.RuleFor(u => u.Id, f => Guid.NewGuid()); faker.RuleFor(u => u.Name, f => f.Company.CompanyName()); faker.RuleFor(u => u.Type, Statics.OrgCustomerType); faker.RuleFor(x => x.Addresses, ServiceMocks.GetAddresses()); faker.RuleFor(x => x.PhoneNumbers, ServiceMocks.GetPhoneNumbers()); faker.RuleFor(u => u.Identifier, (f) => new CodeValue(Statics.NORWEGIAN_ORG_NUMBER, f.Random.String2(9, "0123456789"))); return(faker.Generate(number.GetValueOrDefault(3)).Cast <ICustomer>().ToArray()); }
public static List <ICustomer> GetPersons(int?number = 3) { var faker = new Faker <PrivatePerson>(); faker.RuleFor(u => u.Id, f => Guid.NewGuid()); faker.RuleFor(u => u.FirstName, f => f.Person.FirstName); faker.RuleFor(u => u.LastName, f => f.Person.LastName); faker.RuleFor(u => u.Type, f => Statics.PrivatePersonCustomerType); faker.RuleFor(x => x.Addresses, ServiceMocks.GetAddresses()); faker.RuleFor(x => x.PhoneNumbers, ServiceMocks.GetPhoneNumbers()); faker.RuleFor(u => u.PersonId, f => Guid.NewGuid()); faker.RuleFor(u => u.Identifier, f => { return(new CodeValue(Statics.NORWEGIAN_BIRTHDAY_NUMBER, string.Format("{0}{1}", f.Date.Past().ToString("ddmmdd"), f.Random.String2(5, "0123456789")))); }); return(faker.Generate(number.GetValueOrDefault(3)).Cast <ICustomer>().ToList()); }