Skip to content

Commit

Permalink
bugfix: tests renaming and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikaLos committed Nov 28, 2024
1 parent ef44d1a commit 5d2f714
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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 @@ -22,7 +22,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 All @@ -39,10 +39,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
2 changes: 1 addition & 1 deletion GsaGHTests/TestHelpers/ComponentTestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,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 (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 5d2f714

Please sign in to comment.