BHoM / BHoM_Adapter

GNU Lesser General Public License v3.0
7 stars 7 forks source link

BHoM_Adapter: Issue with some deep dependency types #339

Closed IsakNaslundBh closed 1 year ago

IsakNaslundBh commented 1 year ago

Description:

The dependency order management does not function as intended for some cases.

When for example, pushing a BarUniformlyDistributedLoad without at the same time pushing bars, the dependency sorting makes it so that the bars are pushed as the second item, before Nodes and sections etc.

Steps to reproduce:

A test method like:

        [Test]
        public void DependencyOrder_CreateLoadNoObjectsWithIds()
        {
            List<BarUniformlyDistributedLoad> loads = Create.RandomObjects<BarUniformlyDistributedLoad>(3);

            sa.Push(loads);

            string correctOrder = "BH.oM.Structure.Constraints.Constraint6DOF, BH.oM.Structure.MaterialFragments.IMaterialFragment, BH.oM.Structure.SectionProperties.ISectionProperty, BH.oM.Structure.Elements.Node, BH.oM.Structure.Constraints.BarRelease, BH.oM.Structure.Offsets.Offset, BH.oM.Structure.Elements.Bar, BH.oM.Structure.Loads.BarUniformlyDistributedLoad";
            string createdOrder = string.Join(", ", sa.Created.Select(c => c.Item1.FullName));

            Assert.AreEqual(correctOrder, createdOrder);
        }

Will highlight the problem

Expected behaviour:

For recursive evaluation of dependencies to function, independent on if other objects are pushed simultaneously or not. Order of objects being put in to the push component also should not matter.

Test file(s):

See test method above