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