-
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 6, 2023
1 parent
090465b
commit bb79ea8
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
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,53 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using Grasshopper.Kernel; | ||
using Xunit; | ||
|
||
namespace IntegrationTests.Components { | ||
[Collection("GrasshopperFixture collection")] | ||
public class Display3dTests { | ||
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("Annotate", true)] | ||
[InlineData("Preview", true)] | ||
[InlineData("Diagrams", true)] | ||
[InlineData("Results", 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)); | ||
} | ||
} | ||
} |