public void can_describe_a_step_with_multiple_levels_of_children() { var grandchildStep = new StepDefinition { DeclaringType = typeof(ExampleGrandChildContext), Matcher = new MethodNameMatcher(typeof(ExampleGrandChildContext).GetMethod("Baz")) }; var childStep = new StepDefinition { Children = new[] { grandchildStep }, DeclaringType = typeof(ExampleChildContext), Matcher = new MethodNameMatcher(typeof(ExampleChildContext).GetMethod("Bar")) }; var step = new StepDefinition { Children = new[] { childStep }, DeclaringType = typeof(ExampleParentContext), Matcher = new MethodNameMatcher(typeof(ExampleParentContext).GetMethod("Foo")) }; var result = new StepDescriber().Describe(step); result.Description.ShouldEqual("Foo"); result.ChildDescription.ShouldEqual(" Bar\r\n Baz"); }
private StepViewModel BuildViewModelStep(StepDefinition stepDefinition) { var describer = new StepDescriber(); return new StepViewModel { TypeName = stepDefinition.DeclaringType.FullName, MemberName = stepDefinition.Matcher.MemberInfo.Name, Description = describer.Describe(stepDefinition), IsExtensionMethod = IsExtensionMethod(stepDefinition.Matcher.MemberInfo), Children = stepDefinition.Children.Select(BuildViewModelStep) }; }
private StepViewModel BuildViewModelStep(StepDefinition stepDefinition) { var describer = new StepDescriber(); return(new StepViewModel { TypeName = stepDefinition.DeclaringType.FullName, MemberName = stepDefinition.Matcher.MemberInfo.Name, Description = describer.Describe(stepDefinition), IsExtensionMethod = IsExtensionMethod(stepDefinition.Matcher.MemberInfo), Children = stepDefinition.Children.Select(BuildViewModelStep) }); }