public void ListBind() { var expected = LinqExpression.MemberInit( LinqExpression.New( typeof(SampleClass)), LinqExpression.ListBind( typeof(SampleClass).GetProperty(nameof(SampleClass.ListProperty)), LinqExpression.ElementInit( typeof(List <long>).GetMethod("Add"), LinqExpression.Constant(0L)))); var actual = @" @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix : <http://example.com/> . :s :memberInitNewExpression [ :newType _:C3 ; ] ; :memberInitBindings ( [ :bindMember [ :memberType _:C3 ; :memberName ""ListProperty"" ; ] ; :listBindInitializers ( [ :elementInitAddMethod [ :memberType [ :typeName ""System.Collections.Generic.List`1[System.Int64]"" ; ] ; :memberName ""Add"" ; ] ; :elementInitArguments ( [ :constantValue 0 ; ] ) ; ] ) ; ] ) ; . _:C3 :typeName ""GraphEngine.Tests.SampleClass, GraphEngine.Tests"" ; . "; ShouldBe(actual, expected); }
public void Default() { var expected = LinqExpression.ListInit( LinqExpression.New( typeof(List <long>)), LinqExpression.ElementInit( typeof(List <long>).GetMethod("Add"), LinqExpression.Constant(0L))); var actual = @" @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix : <http://example.com/> . :s :listInitNewExpression [ :newType [ :typeName ""System.Collections.Generic.List`1[System.Int64]"" ; ] ; ] ; :listInitInitializers ( [ :elementInitAddMethod [ :memberType [ :typeName ""System.Collections.Generic.List`1[System.Int64]"" ; ] ; :memberName ""Add"" ; ] ; :elementInitArguments ( [ :constantValue 0 ; ] ) ; ] ) ; . "; ShouldBe(actual, expected); }