-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #769 parameter should be global for interaction container #770
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
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 | ||
{ | ||
public interface IMoleculeBuilderDTOToTreeNodeMapper : IMapper<MoleculeBuilderDTO, IMoleculeTreeNode> | ||
{ | ||
} | ||
|
||
|
||
internal class MoleculeBuilderDTOToTreeNodeMapper : IMoleculeBuilderDTOToTreeNodeMapper | ||
{ | ||
private readonly ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper _activeTransportBuilderContaienrToMolceculeTreeNodeMapper; | ||
private readonly ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper _activeTransportBuilderContainerToMoleculeTreeNodeMapper; | ||
private readonly IInteractionContainerDTOToMoleculeTreeMapper _interactionContainerMapper; | ||
|
||
public MoleculeBuilderDTOToTreeNodeMapper(ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper activeTransportBuilderContaienrToMolceculeTreeNodeMapper, IInteractionContainerDTOToMoleculeTreeMapper interactionContainerMapper) | ||
public MoleculeBuilderDTOToTreeNodeMapper(ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper activeTransportBuilderContainerToMoleculeTreeNodeMapper, IInteractionContainerDTOToMoleculeTreeMapper interactionContainerMapper) | ||
{ | ||
_activeTransportBuilderContaienrToMolceculeTreeNodeMapper = activeTransportBuilderContaienrToMolceculeTreeNodeMapper; | ||
_activeTransportBuilderContainerToMoleculeTreeNodeMapper = activeTransportBuilderContainerToMoleculeTreeNodeMapper; | ||
_interactionContainerMapper = interactionContainerMapper; | ||
} | ||
|
||
public IMoleculeTreeNode MapFrom(MoleculeBuilderDTO input) | ||
public IMoleculeTreeNode MapFrom(MoleculeBuilderDTO moleculeBuilderDTO) | ||
{ | ||
var node = new MoleculeTreeNode(input) {Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the changes here are just a million typos in the file. Not related to actual change |
||
var children = input.TransporterMolecules.MapAllUsing(_activeTransportBuilderContaienrToMolceculeTreeNodeMapper).ToList(); | ||
children = children.Union(input.InteractionContainerCollection.MapAllUsing(_interactionContainerMapper)).ToList(); | ||
var node = new MoleculeTreeNode(moleculeBuilderDTO) {Text = moleculeBuilderDTO.Name, Icon = ApplicationIcons.IconByName(moleculeBuilderDTO.Icon)}; | ||
var children = moleculeBuilderDTO.TransporterMolecules.MapAllUsing(_activeTransportBuilderContainerToMoleculeTreeNodeMapper).ToList(); | ||
children = children.Union(moleculeBuilderDTO.InteractionContainerCollection.MapAllUsing(_interactionContainerMapper)).ToList(); | ||
children.Each(node.AddChild); | ||
return node; | ||
} | ||
} | ||
|
||
|
||
public interface ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper : IMapper<TransporterMoleculeContainerDTO, IMoleculeTreeNode> | ||
{ | ||
} | ||
|
||
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<TransportBuilderDTO, IMoleculeTreeNode> | ||
internal interface ITransportBuilderDTOToMoleculeTreeNodeMapper : IMapper<TransportBuilderDTO, IMoleculeTreeNode> | ||
{ | ||
} | ||
|
||
internal class TranpsortBuilderDTOToMoleculeTreeNodeMapper : ITranpsortBuilderDTOToMoleculeTreeNodeMapper | ||
internal class TransportBuilderDTOToMoleculeTreeNodeMapper : ITransportBuilderDTOToMoleculeTreeNodeMapper | ||
{ | ||
public IMoleculeTreeNode MapFrom(TransportBuilderDTO input) | ||
{ | ||
return new MoleculeTreeNode(input) {Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)}; | ||
} | ||
} | ||
|
||
public interface IInteractionContainerDTOToMoleculeTreeMapper:IMapper<InteractionContainerDTO,IMoleculeTreeNode> | ||
public interface IInteractionContainerDTOToMoleculeTreeMapper : IMapper<InteractionContainerDTO, IMoleculeTreeNode> | ||
{ | ||
|
||
} | ||
|
||
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) | ||
}; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Observations from the base test class are automatically executed when running the tests in the derived class? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah it's because it's derived and we try to find an Obervation in each class. Pretty neat (but potentially way over engineered in this case) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's pretty usefull. |
||
} | ||
} | ||
|
||
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(); | ||
} | ||
} | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fix