diff --git a/src/MoBi.Core/Domain/Extensions/ContainerExtensions.cs b/src/MoBi.Core/Domain/Extensions/ContainerExtensions.cs index 880583427..5b2ecaddd 100644 --- a/src/MoBi.Core/Domain/Extensions/ContainerExtensions.cs +++ b/src/MoBi.Core/Domain/Extensions/ContainerExtensions.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using OSPSuite.Utility.Extensions; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Builder; +using OSPSuite.Utility.Extensions; namespace MoBi.Core.Domain.Extensions { @@ -27,7 +27,8 @@ public static IEnumerable AvailableBuildModeForParameters(th public static ParameterBuildMode DefaultParameterBuildMode(this IContainer container) { var needsGlobalParameter = container.IsAnImplementationOf() || - container.IsAnImplementationOf(); + container.IsAnImplementationOf() || + container.IsAnImplementationOf(); return needsGlobalParameter ? ParameterBuildMode.Global : ParameterBuildMode.Local; } diff --git a/src/MoBi.Presentation/Mappers/MoleculeBuilderDTOToTreeNodeMapper.cs b/src/MoBi.Presentation/Mappers/MoleculeBuilderDTOToTreeNodeMapper.cs index f505456d4..c2b8522ee 100644 --- a/src/MoBi.Presentation/Mappers/MoleculeBuilderDTOToTreeNodeMapper.cs +++ b/src/MoBi.Presentation/Mappers/MoleculeBuilderDTOToTreeNodeMapper.cs @@ -1,9 +1,9 @@ using System.Linq; -using OSPSuite.Utility; -using OSPSuite.Utility.Extensions; using MoBi.Presentation.DTO; using MoBi.Presentation.Nodes; using OSPSuite.Assets; +using OSPSuite.Utility; +using OSPSuite.Utility.Extensions; namespace MoBi.Presentation.Mappers { @@ -11,56 +11,54 @@ public interface IMoleculeBuilderDTOToTreeNodeMapper : IMapper { } internal class TransporterMoleculeContainerDTOToMoleculeTreeNodeMapper : ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper { - private readonly ITranpsortBuilderDTOToMoleculeTreeNodeMapper _activeTransportRealizationsBuilderToMolceculeTreeNodeMapper; + private readonly ITransportBuilderDTOToMoleculeTreeNodeMapper _activeTransportRealizationsBuilderToMoleculeTreeNodeMapper; - public TransporterMoleculeContainerDTOToMoleculeTreeNodeMapper(ITranpsortBuilderDTOToMoleculeTreeNodeMapper activeTransportRealizationsBuilderToMolceculeTreeNodeMapper) + public TransporterMoleculeContainerDTOToMoleculeTreeNodeMapper(ITransportBuilderDTOToMoleculeTreeNodeMapper activeTransportRealizationsBuilderToMoleculeTreeNodeMapper) { - _activeTransportRealizationsBuilderToMolceculeTreeNodeMapper = activeTransportRealizationsBuilderToMolceculeTreeNodeMapper; + _activeTransportRealizationsBuilderToMoleculeTreeNodeMapper = activeTransportRealizationsBuilderToMoleculeTreeNodeMapper; } public IMoleculeTreeNode MapFrom(TransporterMoleculeContainerDTO input) { var node = new MoleculeTreeNode(input) {Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)}; - var children = input.Realizations.MapAllUsing(_activeTransportRealizationsBuilderToMolceculeTreeNodeMapper); + var children = input.Realizations.MapAllUsing(_activeTransportRealizationsBuilderToMoleculeTreeNodeMapper); children.Each(node.AddChild); return node; } } - internal interface ITranpsortBuilderDTOToMoleculeTreeNodeMapper : IMapper + internal interface ITransportBuilderDTOToMoleculeTreeNodeMapper : IMapper { } - internal class TranpsortBuilderDTOToMoleculeTreeNodeMapper : ITranpsortBuilderDTOToMoleculeTreeNodeMapper + internal class TransportBuilderDTOToMoleculeTreeNodeMapper : ITransportBuilderDTOToMoleculeTreeNodeMapper { public IMoleculeTreeNode MapFrom(TransportBuilderDTO input) { @@ -68,16 +66,18 @@ public IMoleculeTreeNode MapFrom(TransportBuilderDTO input) } } - public interface IInteractionContainerDTOToMoleculeTreeMapper:IMapper + public interface IInteractionContainerDTOToMoleculeTreeMapper : IMapper { - } - class InteractionContainerDTOToMoleculeTreeMapper : IInteractionContainerDTOToMoleculeTreeMapper + public class InteractionContainerDTOToMoleculeTreeMapper : IInteractionContainerDTOToMoleculeTreeMapper { - public IMoleculeTreeNode MapFrom(InteractionContainerDTO input) + public IMoleculeTreeNode MapFrom(InteractionContainerDTO interactionContainerDTO) { - return new MoleculeTreeNode(input) {Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)}; + return new MoleculeTreeNode(interactionContainerDTO) + { + Text = interactionContainerDTO.Name, Icon = ApplicationIcons.IconByName(interactionContainerDTO.Icon) + }; } } } \ No newline at end of file diff --git a/src/MoBi.Presentation/MenusAndBars/ContextMenus/ContextMenuSpecificationFactoryForInteractionContainer.cs b/src/MoBi.Presentation/MenusAndBars/ContextMenus/ContextMenuSpecificationFactoryForInteractionContainer.cs index 65e1d8466..93861c8b8 100644 --- a/src/MoBi.Presentation/MenusAndBars/ContextMenus/ContextMenuSpecificationFactoryForInteractionContainer.cs +++ b/src/MoBi.Presentation/MenusAndBars/ContextMenus/ContextMenuSpecificationFactoryForInteractionContainer.cs @@ -1,18 +1,16 @@ using MoBi.Assets; -using OSPSuite.Presentation.MenuAndBars; -using OSPSuite.Utility.Container; -using OSPSuite.Utility.Extensions; -using MoBi.Core; using MoBi.Core.Domain.Model; -using MoBi.Core.Helper; using MoBi.Presentation.DTO; using MoBi.Presentation.UICommand; +using OSPSuite.Assets; using OSPSuite.Core.Domain.Builder; using OSPSuite.Core.Domain.Services; using OSPSuite.Presentation.Core; +using OSPSuite.Presentation.MenuAndBars; using OSPSuite.Presentation.Presenters; using OSPSuite.Presentation.Presenters.ContextMenus; -using OSPSuite.Assets; +using OSPSuite.Utility.Container; +using OSPSuite.Utility.Extensions; namespace MoBi.Presentation.MenusAndBars.ContextMenus { @@ -20,21 +18,21 @@ internal class ContextMenuSpecificationFactoryForInteractionContainer : IContext { public IContextMenu CreateFor(IViewItem viewItem, IPresenterWithContextMenu presenter) { - //As long as Interaction Container is "just" a "container" we can reuse the container in event group here.(allows no subcontainer) + //As long as Interaction Container is "just" a "container" we can reuse the container in event group here.(allows no sub-container) return IoC.Resolve().InitializeWith(viewItem as ContainerDTO, presenter); } public bool IsSatisfiedBy(IViewItem objectRequestingContextMenu, IPresenterWithContextMenu presenter) - { + { return objectRequestingContextMenu.IsAnImplementationOf(); } } - internal interface IContextMenuForContainerInMoleculeBuildingBlock:IContextMenuFor + internal interface IContextMenuForContainerInMoleculeBuildingBlock : IContextMenuFor { } - class ContextMenuForContainerInMoleculeBuildingBlock :ContextMenuForContainerBase, IContextMenuForContainerInMoleculeBuildingBlock + class ContextMenuForContainerInMoleculeBuildingBlock : ContextMenuForContainerBase, IContextMenuForContainerInMoleculeBuildingBlock { public ContextMenuForContainerInMoleculeBuildingBlock(IMoBiContext context, IObjectTypeResolver objectTypeResolver) : base(context, objectTypeResolver) { diff --git a/tests/MoBi.Tests/Core/Commands/AddParameterToContainerCommandSpecs.cs b/tests/MoBi.Tests/Core/Commands/AddParameterToContainerCommandSpecs.cs index 57819f617..9f35a6430 100644 --- a/tests/MoBi.Tests/Core/Commands/AddParameterToContainerCommandSpecs.cs +++ b/tests/MoBi.Tests/Core/Commands/AddParameterToContainerCommandSpecs.cs @@ -1,7 +1,7 @@ -using OSPSuite.BDDHelper; -using OSPSuite.BDDHelper.Extensions; -using FakeItEasy; +using FakeItEasy; using MoBi.Core.Domain.Model; +using OSPSuite.BDDHelper; +using OSPSuite.BDDHelper.Extensions; using OSPSuite.Core.Domain; using OSPSuite.Core.Domain.Builder; @@ -62,6 +62,19 @@ protected override ParameterBuildMode GetBuildModeType() } } + public class When_adding_a_new_parameter_to_interaction_container : When_testing_for_appropriate_parameter_build_modes + { + protected override IContainer GetContainer() + { + return new InteractionContainer(); + } + + protected override ParameterBuildMode GetBuildModeType() + { + return ParameterBuildMode.Global; + } + } + public class When_adding_a_new_parameter_to_a_generic_container : When_testing_for_appropriate_parameter_build_modes { protected override IContainer GetContainer() @@ -75,7 +88,7 @@ protected override ParameterBuildMode GetBuildModeType() } } - public class When_executing_inverse_of_add_a_new_paramter_to_container : concern_for_AddParameterToContainerCommand + public class When_executing_inverse_of_add_a_new_parameter_to_container : concern_for_AddParameterToContainerCommand { protected override void Context() { @@ -101,5 +114,4 @@ public void the_parameter_should_be_removed_from_the_container() _container.ShouldBeEmpty(); } } - -} +} \ No newline at end of file