You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs

40 lines
1.3 KiB

8 years ago
using System;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.TestApp.Domain;
namespace Volo.Abp.TestApp
{
public class TestDataBuilder : ITransientDependency
{
public static Guid TenantId1 { get; } = new Guid("55687dce-595c-41b4-a024-2a5e991ac8f4");
public static Guid TenantId2 { get; } = new Guid("f522d19f-5a86-4278-98fb-0577319c544a");
8 years ago
private readonly IRepository<Person> _personRepository;
public TestDataBuilder(IRepository<Person> personRepository)
{
_personRepository = personRepository;
}
public void Build()
{
AddPeople();
}
private void AddPeople()
{
var douglas = new Person(Guid.NewGuid(), "Douglas", 42);
douglas.Phones.Add(new Phone(douglas.Id, "123456789"));
douglas.Phones.Add(new Phone(douglas.Id, "123456780", PhoneType.Home));
_personRepository.Insert(douglas);
var tenant1Person1 = new Person(Guid.NewGuid(), TenantId1 + "-Person1", 42, TenantId1);
var tenant1Person2 = new Person(Guid.NewGuid(), TenantId1 + "-Person2", 43, TenantId1);
_personRepository.Insert(tenant1Person1);
_personRepository.Insert(tenant1Person2);
8 years ago
}
}
}