public static AllowedHierarchy Build(int depth) { var retVal = new AllowedHierarchy(); var current = retVal; while (depth > 0) { current.Child = new AllowedHierarchy(); current = current.Child; depth--; } return(retVal); }
public void TypeWalker_StressTest_AllowedHierarchy_Visit() { //Arrange var visitor = TypeWalker <AllowedHierarchy> .Create().ForProperty <DateTime>((x, m) => DateTime.Now.AddYears(10)).Build(10, new PropertyGuard()); var hierarchy = new Faker <AllowedHierarchy>().StrictMode(false) .CustomInstantiator(x => AllowedHierarchy.Build(6)) .Generate(); var values = new HashSet <PropertyValue>(); //Act visitor.Visit(hierarchy, depth: 10, guard: new InstanceGuard(), values: values); //Assert Assert.AreEqual(7, values.Count); }