public void OneLevelOneExpand_ReturnsCorrectQuery() { var representation = new D365ModelRepresentation { RootExpandName = string.Empty, BaseProperties = new List <string> { "property_one", "property_two" }, ExpandProperties = new List <D365ModelRepresentation> { new D365ModelRepresentation { RootExpandName = "expand_root", BaseProperties = new List <string> { "expand1_prop1", "expand1_prop2" } } } }; var helper = new D365ModelHelper <BaseD365Model>(); var result = helper.BuildSelectAndExpandClauses(representation); Assert.Equal("$select=property_one,property_two&$expand=expand_root($select=expand1_prop1,expand1_prop2)", result); }
public void JaggedExpansionLevels_ShouldReturnCorrectQuery() { var representation = new D365ModelRepresentation { RootExpandName = string.Empty, BaseProperties = new List <string> { "property_one", "property_two" }, ExpandProperties = new List <D365ModelRepresentation> { new D365ModelRepresentation { RootExpandName = "expand_root1", BaseProperties = new List <string> { "expand1_prop1", "expand1_prop2" }, ExpandProperties = new List <D365ModelRepresentation> { new D365ModelRepresentation { RootExpandName = "expand_root2", BaseProperties = new List <string> { "expand2_prop1", "expand2_prop2" } }, new D365ModelRepresentation { RootExpandName = "expand_root3", BaseProperties = new List <string> { "expand3_prop1", "expand3_prop2" }, ExpandProperties = new List <D365ModelRepresentation> { new D365ModelRepresentation { RootExpandName = "expand_root4", BaseProperties = new List <string> { "expand4_prop1", "expand4_prop2" } }, new D365ModelRepresentation { RootExpandName = "expand_root5", BaseProperties = new List <string> { "expand5_prop1", "expand5_prop2" } } } } } }, } }; var helper = new D365ModelHelper <BaseD365Model>(); var result = helper.BuildSelectAndExpandClauses(representation); Assert.Equal("$select=property_one,property_two&$expand=expand_root1($select=expand1_prop1,expand1_prop2;$expand=expand_root2($select=expand2_prop1,expand2_prop2),expand_root3($select=expand3_prop1,expand3_prop2;$expand=expand_root4($select=expand4_prop1,expand4_prop2),expand_root5($select=expand5_prop1,expand5_prop2)))", result); }
public void NoExpandLevels_ReturnsCorrectQuery() { var representation = new D365ModelRepresentation { RootExpandName = string.Empty, BaseProperties = new List <string> { "property_one", "property_two" }, ExpandProperties = new List <D365ModelRepresentation>() }; var helper = new D365ModelHelper <BaseD365Model>(); var result = helper.BuildSelectAndExpandClauses(representation); Assert.Equal("$select=property_one,property_two", result); }