File tree Expand file tree Collapse file tree
src/MoBi.Core/Domain/Extensions
tests/MoBi.Tests/Core/Commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public static ParameterBuildMode DefaultParameterBuildMode(this IContainer conta
2626 var needsGlobalParameter = container . IsAnImplementationOf < TransporterMoleculeContainer > ( ) ||
2727 container . IsAnImplementationOf < ReactionBuilder > ( ) ||
2828 container . IsAnImplementationOf < InteractionContainer > ( ) ||
29- container . IsMoleculeProperties ( ) ;
29+ container . IsGlobalMoleculeProperties ( ) ;
3030
3131 return needsGlobalParameter ? ParameterBuildMode . Global : ParameterBuildMode . Local ;
3232 }
Original file line number Diff line number Diff line change @@ -16,6 +16,16 @@ public static bool IsMoleculeProperties(this IContainer container)
1616 return container . IsNamed ( Constants . MOLECULE_PROPERTIES ) ;
1717 }
1818
19+ /// <summary>
20+ /// Returns <c>true</c> for the global <c>MoleculeProperties</c> container that is a special member of a
21+ /// <see cref="OSPSuite.Core.Domain.Builder.SpatialStructure" /> (created with <see cref="ContainerType.Molecule" />),
22+ /// as opposed to the local <c>MoleculeProperties</c> containers nested in physical containers.
23+ /// </summary>
24+ public static bool IsGlobalMoleculeProperties ( this IContainer container )
25+ {
26+ return container . IsMoleculeProperties ( ) && container . ContainerType == ContainerType . Molecule ;
27+ }
28+
1929 public static bool IsAtMoleculeBuilder ( this IEntity entity )
2030 {
2131 return entity . RootContainer . IsAnImplementationOf < MoleculeBuilder > ( ) ;
Original file line number Diff line number Diff line change @@ -75,11 +75,11 @@ protected override ParameterBuildMode GetBuildModeType()
7575 }
7676 }
7777
78- public class When_adding_a_new_parameter_to_molecule_properties_container : When_testing_for_appropriate_parameter_build_modes
78+ public class When_adding_a_new_parameter_to_the_global_molecule_properties_container : When_testing_for_appropriate_parameter_build_modes
7979 {
8080 protected override IContainer GetContainer ( )
8181 {
82- return new Container ( ) . WithName ( Constants . MOLECULE_PROPERTIES ) ;
82+ return new Container ( ) . WithName ( Constants . MOLECULE_PROPERTIES ) . WithContainerType ( ContainerType . Molecule ) ;
8383 }
8484
8585 protected override ParameterBuildMode GetBuildModeType ( )
@@ -88,6 +88,19 @@ protected override ParameterBuildMode GetBuildModeType()
8888 }
8989 }
9090
91+ public class When_adding_a_new_parameter_to_a_local_molecule_properties_container : When_testing_for_appropriate_parameter_build_modes
92+ {
93+ protected override IContainer GetContainer ( )
94+ {
95+ return new Container ( ) . WithName ( Constants . MOLECULE_PROPERTIES ) . WithContainerType ( ContainerType . Compartment ) ;
96+ }
97+
98+ protected override ParameterBuildMode GetBuildModeType ( )
99+ {
100+ return ParameterBuildMode . Local ;
101+ }
102+ }
103+
91104 public class When_adding_a_new_parameter_to_a_generic_container : When_testing_for_appropriate_parameter_build_modes
92105 {
93106 protected override IContainer GetContainer ( )
You can’t perform that action at this time.
0 commit comments