public IEdge Build() { IEdge edge = Substitute.For <IEdge>(); edge.ChildNode.Returns(ChildNode); if (ChildExtractor != null) { edge.ExtractChildValue(Arg.Any <T>()) .Returns(args => ChildExtractor((T)args[0])); } SetupSetChildValue(edge); return(edge); }