public static NestingClass CreateNesting(int levelOfNesting) { var parent = new NestingClass(); var tmp = parent; for (var i = 0; i < levelOfNesting; i++) { tmp.Son = new NestingClass(); tmp = tmp.Son; } return(parent); }
public void PrintInformativeMessage_WhenNestingOverflow() { var nesting = NestingClass.CreateNesting(3); var printer = ObjectPrinter .For <NestingClass>() .WithNestingLevel(2); result = printer.PrintToString(nesting); result.Should().Be("NestingClass\r\n" + "\tSon = NestingClass\r\n" + "\t\tSon = reached max nesting level\r\n"); }