Skip to content

Commit

Permalink
GSAGH-367 AssembleModelTests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilman Reinhardt committed Oct 10, 2023
1 parent b126e8a commit 89ad8dc
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
Binary file added ExampleFiles/Components/AssembleModel.gh
Binary file not shown.
50 changes: 50 additions & 0 deletions IntegrationTests/3_Components/AssembleModelTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.IO;
using System.Reflection;
using Grasshopper.Kernel;
using Xunit;

namespace IntegrationTests.Components {
[Collection("GrasshopperFixture collection")]
public class AssembleModelTests {
public static GH_Document Document {
get {
if (document == null) {
document = OpenDocument();
}

return document;
}
}
private static GH_Document document = null;

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

[Theory]
[InlineData("HasResult", true)]
public void Test(string groupIdentifier, object expected) {
IGH_Param param = Helper.FindParameter(Document, groupIdentifier);
Helper.TestGhPrimitives(param, expected);
}

private static GH_Document OpenDocument() {
Type thisClass = MethodBase.GetCurrentMethod().DeclaringType;
string fileName = thisClass.Name + ".gh";
fileName = fileName.Replace(thisClass.Namespace, string.Empty).Replace("Tests", string.Empty);

string solutiondir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent
.Parent.FullName;
string path = Path.Combine(new string[] {
solutiondir,
"ExampleFiles",
"Components",
});

return Helper.CreateDocument(Path.Combine(path, fileName));
}
}
}

0 comments on commit 89ad8dc

Please sign in to comment.