Skip to content

Commit

Permalink
GSAGH-367 Display3dTests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilman Reinhardt committed Oct 6, 2023
1 parent 090465b commit bb79ea8
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions IntegrationTests/3_Components/Display3dTests.cs
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));
}
}
}

0 comments on commit bb79ea8

Please sign in to comment.