-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tilman Reinhardt
committed
Oct 10, 2023
1 parent
b126e8a
commit 89ad8dc
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
} |