public void ExtractModelRepresentation_OneLevelTwoExpansion()
        {
            var helper = new D365ModelHelper <OneLevelTwoExpand>();

            var result = helper.ExtractModelRepresentation();

            //No root expand name for root level
            Assert.Equal(string.Empty, result.RootExpandName);
            //Three base properties, one owned
            Assert.Equal(3, result.BaseProperties.Count);
            //Should containe owned property
            Assert.Contains("someproperty", result.BaseProperties);
            //One Level One expand
            Assert.Single(result.ExpandProperties);
            //First Level One expansion has correct root name
            Assert.Equal("leveloneexpand", result.ExpandProperties[0].RootExpandName);
            //First Level One expansion has one property
            Assert.Single(result.ExpandProperties[0].BaseProperties);
            //First Level One expansion -> first property has correct name
            Assert.Equal("leveloneexpandprop", result.ExpandProperties[0].BaseProperties[0]);
            //Level One expand contains nested expand
            Assert.Single(result.ExpandProperties[0].ExpandProperties);
            //Level Two expand has correct root name
            Assert.Equal("leveltwoexpand", result.ExpandProperties[0].ExpandProperties[0].RootExpandName);
            //Level Two expand has one property
            Assert.Single(result.ExpandProperties[0].ExpandProperties[0].BaseProperties);
            //Level Two expand has correct property name
            Assert.Equal("leveltwoexpandprop", result.ExpandProperties[0].ExpandProperties[0].BaseProperties[0]);
            //Level Two expand has no nested expand
            Assert.Empty(result.ExpandProperties[0].ExpandProperties[0].ExpandProperties);
        }
        public void ExtractModelRepresentation_TwoLevelOneExpansions()
        {
            var helper = new D365ModelHelper <TwoLevelOneExpands>();

            var result = helper.ExtractModelRepresentation();

            //No root expand name for root level
            Assert.Equal(string.Empty, result.RootExpandName);
            //Two base properties, one owned
            Assert.Equal(3, result.BaseProperties.Count);
            //Two Level Two expands
            Assert.Equal(2, result.ExpandProperties.Count);
            //First Level One expansion has correct root name
            Assert.Equal("leveloneexpand_one", result.ExpandProperties[0].RootExpandName);
            //First Level One expansion has two properties
            Assert.Equal(2, result.ExpandProperties[0].BaseProperties.Count);
            //First Level One expansion -> first property has correct name
            Assert.Equal("LevelOneExpand_One_Prop1", result.ExpandProperties[0].BaseProperties[0]);
            //First Level One expansion -> second property has correct name
            Assert.Equal("LevelOneExpand_One_Prop2", result.ExpandProperties[0].BaseProperties[1]);
            //First Level one expansion has no nested expands
            Assert.Empty(result.ExpandProperties[0].ExpandProperties);
            //Second Level One Expansion Has Correct Root Name
            Assert.Equal("leveloneexpand_two", result.ExpandProperties[1].RootExpandName);
            //Second Level One expansion has two properties
            Assert.Equal(3, result.ExpandProperties[1].BaseProperties.Count);
            //Second Level One expansion -> first property has correct name
            Assert.Equal("LevelOneExpand_Two_Prop1", result.ExpandProperties[1].BaseProperties[0]);
            //Second Level One expansion -> second property has correct name
            Assert.Equal("LevelOneExpand_Two_Prop2", result.ExpandProperties[1].BaseProperties[1]);
            //Second Level One expansion -> third property has correct name
            Assert.Equal("LevelOneExpand_One_Prop3", result.ExpandProperties[1].BaseProperties[2]);
            //Second Level one expansion has no nested expands
            Assert.Empty(result.ExpandProperties[1].ExpandProperties);
        }
        public void ExtractModelRepresentation_NoExpandLevels()
        {
            var helper = new D365ModelHelper <NoExpandLevels>();

            var result = helper.ExtractModelRepresentation();

            //No root expand name for root level
            Assert.Equal(string.Empty, result.RootExpandName);
            //Two base properties, one owned
            Assert.Equal(4, result.BaseProperties.Count);
            //Should return the property name with no annotations
            Assert.Contains("someproperty", result.BaseProperties);
            //Should return the property name with no annotations
            Assert.Contains("anotherproperty", result.BaseProperties);
            //No nested expansion levels
            Assert.Empty(result.ExpandProperties);
        }
        public void ExtractModelRepresentation_OneLevelOneExpansion()
        {
            var helper = new D365ModelHelper <OneExpandLevelOneExpand>();

            var result = helper.ExtractModelRepresentation();

            //No root expand name for root level
            Assert.Equal(string.Empty, result.RootExpandName);
            //Two base properties, one owned
            Assert.Equal(3, result.BaseProperties.Count);
            //Should bring back correct name for own property
            Assert.Contains("someproperty", result.BaseProperties);
            //One level one expand
            Assert.Single(result.ExpandProperties);
            //Level one expand has correct name
            Assert.Equal("leveloneexpand", result.ExpandProperties[0].RootExpandName);
            //Level one expand has two properties
            Assert.Equal(2, result.ExpandProperties[0].BaseProperties.Count);
            //Level one expand property with no metadata has correct name
            Assert.Contains("levelonepropnometadata", result.ExpandProperties[0].BaseProperties);
            //Level one expand property with metadata has correct name
            Assert.Contains("levelonepropwithmetadata", result.ExpandProperties[0].BaseProperties);
        }