mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-12 05:58:34 +00:00
+ Fixed an issue where the children of Union as per Children() appeared in the reverse of the expected order
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using OSCADSharp.Solids;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace OSCADSharp.UnitTests
|
|
{
|
|
[TestClass]
|
|
public class UnionTests
|
|
{
|
|
[TestMethod]
|
|
public void Union_AffectedObjectsAreChildren()
|
|
{
|
|
var union = new Cube().Union(new Cylinder());
|
|
var children = union.Children();
|
|
|
|
Assert.IsTrue(children.ElementAt(0).GetType() == typeof(Cube));
|
|
Assert.IsTrue(children.ElementAt(1).GetType() == typeof(Cylinder));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Union_AffectedObjectsAreInOutputScript()
|
|
{
|
|
var union = new Cube().Union(new Cylinder());
|
|
string script = union.ToString();
|
|
|
|
Assert.IsTrue(script.Contains("cube("));
|
|
Assert.IsTrue(script.Contains("cylinder("));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Union_FirstStatementInOutputScriptIsUnionMethodCall()
|
|
{
|
|
var union = new Cube().Union(new Cylinder());
|
|
string script = union.ToString();
|
|
|
|
Assert.IsTrue(script.StartsWith("union()"));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Union_FirstElementAppearsFirstInOutputScript()
|
|
{
|
|
var union = new Cube().Union(new Cylinder());
|
|
string script = union.ToString();
|
|
|
|
Assert.IsTrue(script.IndexOf("cube(") < script.IndexOf("cylinder("));
|
|
}
|
|
}
|
|
}
|