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

30 lines
816 B

using System;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.TestApp.Domain;
namespace Volo.Abp.TestApp
{
public class TestDataBuilder : ITransientDependency
{
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);
}
}
}