Skip to content

Commit

Permalink
feat: merged 5d2f714
Browse files Browse the repository at this point in the history
  • Loading branch information
psarras committed Nov 29, 2024
2 parents 82f89b1 + 5d2f714 commit e3dba5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace GsaGHTests.Helpers.Assemble {
[Collection("GrasshopperFixture collection")]
public class AssembleModelLists {
public class AssembleModelListsTests {
private const int DefaultId = 1;
private const string ExpectedName = "create list test";
private const string ExpectedDefinition = "1 2 3";
Expand All @@ -29,7 +29,7 @@ public void ListShouldReturnDefinitionWhenIdIsSet() {

[Fact]
public void ListShouldReturnDefinitionWhenIdIsNotSet() {
GsaList gsaList = GsaList(DefaultId);
GsaList gsaList = GsaList(null);

Assert.Equal(DefaultId, gsaList.Id);
Assert.Equal(ExpectedName, gsaList.Name);
Expand Down Expand Up @@ -102,10 +102,7 @@ private static GsaListGoo CreateListComponent(int? id) {
var createListComponent = new CreateList();
createListComponent.CreateAttributes();

if (id != DefaultId) {
ComponentTestHelper.SetInput(createListComponent, id, 0);
}

ComponentTestHelper.SetInput(createListComponent, id, 0);
ComponentTestHelper.SetInput(createListComponent, ExpectedName, 1);
ComponentTestHelper.SetInput(createListComponent, ExpectedDefinition, 2);

Expand Down
4 changes: 1 addition & 3 deletions GsaGHTests/TestHelpers/ComponentTestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ public static void SetInput(GH_Component component, object obj, string name) {
private static Param_GenericObject GetGenericParameterFor(object obj) {
var input = new Param_GenericObject();
input.CreateAttributes();
if (obj == null) {
input.PersistentData.Append(new GH_ObjectWrapper(obj));
} else if (typeof(IQuantity).IsAssignableFrom(obj.GetType())) {
if (typeof(IQuantity).IsAssignableFrom(obj?.GetType())) {
input.PersistentData.Append(new GH_UnitNumber((IQuantity)obj));
} else {
input.PersistentData.Append(new GH_ObjectWrapper(obj));
Expand Down

0 comments on commit e3dba5e

Please sign in to comment.