I have a set of Data Access classes that are nested fairly deep.
To construct a list of 5 of them takes AutoFixture more than 2 minutes. 2 minutes per Unit test is way to long.
If I was coding them by hand, I would only code up the ones I need, so it would initialize quicker. Is there a way to tell AutoFixture to only do some of the properties so it can not spend time with areas of my structure I don't need?
For example:
public class OfficeBuilding
{
public List<Office> Offices {get; set;}
}
public class Office
{
public List<PhoneBook> YellowPages {get; set;}
public List<PhoneBook> WhitePages {get; set;}
}
public class PhoneBook
{
public List<Person> AllContacts {get; set;}
public List<Person> LocalContacts {get; set;}
}
public class Person
{
public int ID { get; set; }
public string FirstName { get; set;}
public string LastName { get; set;}
public DateTime DateOfBirth { get; set; }
public char Gender { get; set; }
public List<Address> Addresses {get; set;}
}
public class Addresses
{
public string Address1 { get; set; }
public string Address2 { get; set; }
}
Is there a way to tell AutoFixture to create values for OfficeBuilding.Offices.YellowPages.LocalContacts
, but not to bother with OfficeBuilding.Offices.YellowPages.AllContacts
?
return new NoSpecimen(request);
(obsolete) could be replaced withreturn new NoSpecimen();
– Lilalilac