Skip to content

Commit

Permalink
List for Member and Property tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristjan Nielsen committed Oct 9, 2023
1 parent 74d7ea3 commit d9332b7
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Members.gh
Binary file not shown.
Binary file modified ExampleFiles/Parameters/0_Model/GsaList_Properties.gh
Binary file not shown.
3 changes: 0 additions & 3 deletions GsaGH/Helpers/Assembly/Model/Lists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@ private void ConvertList(List<GsaList> lists, GH_Component owner) {
}

private void ConvertList(GsaList list, GH_Component owner) {
if (list == null) {
return;
}
GsaList copyList;
switch (list.EntityType) {
case EntityType.Element:
Expand Down
12 changes: 6 additions & 6 deletions GsaGH/Helpers/Assembly/Properties/Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ private static GsaGuidDictionary<Prop3D> GetProp3dDictionary(GsaModel model) {
}

private string GetPropertyReferenceDefinition(Guid guid) {
if (_sections.GuidDictionary.TryGetValue(guid, out int steelId)) {
return "PB" + steelId;
if (_sections.GuidDictionary.TryGetValue(guid, out int sectionId)) {
return "PB" + sectionId;
}

if (_prop2ds.GuidDictionary.TryGetValue(guid, out int concreteId)) {
return "PA" + concreteId;
if (_prop2ds.GuidDictionary.TryGetValue(guid, out int pro2dId)) {
return "PA" + pro2dId;
}

if (_prop3ds.GuidDictionary.TryGetValue(guid, out int frpId)) {
return "PV" + frpId;
if (_prop3ds.GuidDictionary.TryGetValue(guid, out int prop3dId)) {
return "PV" + prop3dId;
}

return GetMaterialReferenceDefinition(guid);
Expand Down
4 changes: 2 additions & 2 deletions GsaGH/Helpers/GH/Inputs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ internal static List<object> GetGooObjectsForLists(
break;

case GsaProperty3dGoo prop3dGoo:
list.Add(prop3dGoo);
break;
owner.AddRuntimeError($"Unable to reference 3D property in a Member list.");
continue;

case GsaMember1dGoo member1dGoo:
list.Add(member1dGoo);
Expand Down
9 changes: 9 additions & 0 deletions IntegrationTests/2_Parameters/0_Model/GsaList_Members_Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public void NoRuntimeErrorTest() {
Helper.TestNoRuntimeMessagesInDocument(Document, GH_RuntimeMessageLevel.Error);
}

[Fact]
public void NoRuntimeWarningsTest() {
Helper.TestNoRuntimeMessagesInDocument(Document, GH_RuntimeMessageLevel.Warning, "Warning");
}

[Theory]
[InlineData("Test1Id", 1)]
[InlineData("Test1Name", "Columns")]
Expand All @@ -36,6 +41,10 @@ public void NoRuntimeErrorTest() {
[InlineData("Test5Name", "Ground floor")]
[InlineData("Test5Type", "Member")]
[InlineData("Test5Count", 1)]
[InlineData("Test6Id", 99)]
[InlineData("Test6Name", "3d list")]
[InlineData("Test6Type", "Member")]
[InlineData("Test6Count", 1)]
public void Test(string groupIdentifier, object expected) {
IGH_Param param = Helper.FindParameter(Document, groupIdentifier);
Helper.TestGhPrimitives(param, expected);
Expand Down
11 changes: 10 additions & 1 deletion IntegrationTests/2_Parameters/0_Model/GsaList_Properties_Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ public class GsaList_Properties_Test {

[Fact]
public void NoRuntimeErrorTest() {
Helper.TestNoRuntimeMessagesInDocument(Document, GH_RuntimeMessageLevel.Error);
Helper.TestNoRuntimeMessagesInDocument(Document, GH_RuntimeMessageLevel.Error, "Error");
}

[Fact]
public void NoRuntimeWarningsTest() {
Helper.TestNoRuntimeMessagesInDocument(Document, GH_RuntimeMessageLevel.Warning, "Warning");
}

[Theory]
Expand Down Expand Up @@ -47,6 +52,10 @@ public void NoRuntimeErrorTest() {
[InlineData("Test10Name", "Slabs Material list")]
[InlineData("Test10Type", "Element")]
[InlineData("Test10Count", 6)]
[InlineData("Test11Id", 5)]
[InlineData("Test11Name", "E3d list")]
[InlineData("Test11Type", "Element")]
[InlineData("Test11Count", 1)]
public void Test(string groupIdentifier, object expected) {
IGH_Param param = Helper.FindParameter(Document, groupIdentifier);
Helper.TestGhPrimitives(param, expected);
Expand Down

0 comments on commit d9332b7

Please sign in to comment.