/// <inheritdoc /> public IGraphPatternBuilder Union(GraphPatternBuilder firstGraphPattern, params GraphPatternBuilder[] unionedGraphPatternBuilders) { if (unionedGraphPatternBuilders == null || unionedGraphPatternBuilders.Length == 0) { return(Child(firstGraphPattern)); } var union = new GraphPatternBuilder(GraphPatternType.Union); union.Child(firstGraphPattern); foreach (var builder in unionedGraphPatternBuilders) { union.Child(builder); } _childGraphPatternBuilders.Add(union); return(this); }
public void ShouldAllowAddingSimpleChildGraphPatterns() { // given _builder.Child(cp => cp.Child(cp2 => cp2.Child(cp3 => cp3.Child(cp4 => cp4.Child(last => { }))))); // when var graphPattern = _builder.BuildGraphPattern(_namespaceMapper.Object); // then for (int i = 0; i < 4; i++) { Assert.Equal(1, graphPattern.ChildGraphPatterns.Count); graphPattern = graphPattern.ChildGraphPatterns.Single(); } }