diff --git a/Structurizr.Core.Tests/View/ComponentViewTests.cs b/Structurizr.Core.Tests/View/ComponentViewTests.cs index d3a52bf..b1d6458 100644 --- a/Structurizr.Core.Tests/View/ComponentViewTests.cs +++ b/Structurizr.Core.Tests/View/ComponentViewTests.cs @@ -242,25 +242,6 @@ public void Test_Add_DoesNothing_WhenTheSpecifiedComponentIsAlreadyInTheView() Assert.Equal(1, view.Elements.Count); } - [Fact] - public void Test_Add_DoesNothing_WhenTheSpecifiedComponentIsInADifferentContainer() - { - SoftwareSystem softwareSystemA = Model.AddSoftwareSystem("System A", "Description"); - - Container containerA1 = softwareSystemA.AddContainer("Container A1", "Description", "Tec"); - Component componentA1_1 = containerA1.AddComponent("Component A1-1", "Description"); - - Container containerA2 = softwareSystemA.AddContainer("Container A2", "Description", "Tec"); - Component componentA2_1 = containerA2.AddComponent("Component A2-1", "Description"); - - view = new ComponentView(containerA1, "components", "Description"); - view.Add(componentA1_1); - view.Add(componentA2_1); - - Assert.Equal(1, view.Elements.Count); - Assert.True(view.Elements.Contains(new ElementView(componentA1_1))); - } - [Fact] public void Test_Add_DoesNothing_WhenTheContainerOfTheViewIsAdded() { diff --git a/Structurizr.Core/View/ComponentView.cs b/Structurizr.Core/View/ComponentView.cs index ae82dd3..f7f0def 100644 --- a/Structurizr.Core/View/ComponentView.cs +++ b/Structurizr.Core/View/ComponentView.cs @@ -101,10 +101,7 @@ public void Add(Component component) { if (component != null) { - if (Container.Equals(component.Container)) - { - AddElement(component, true); - } + AddElement(component, true); } } diff --git a/docs/changelog.md b/docs/changelog.md index 4b0990a..10c510c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,6 +6,7 @@ - Added a 16:10 ratio paper size. - Added a "Component" element shape. - Added a "Dotted" element border style. +- Components from any container can now be added to a component view. ## 0.9.6 (29th February 2020)