Michael Smith de013112db + Renamed Variable.Name to Variable.Text
+ Added CompoundVariable as result from operations on variables
+ Added constructor flag for Variable to optionally add it to globals on creation
2016-03-06 18:09:21 -08:00

31 lines
878 B
C#

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OSCADSharp.UnitTests.Scripting
{
[TestClass]
public class VariableTests
{
[TestMethod]
public void Variables_CreatingVariableWithTrueForGlobalAddsGlobals()
{
var myVariable = new Variable("overallWidth", Inches.ToMillimeters(3.5), true);
Assert.AreEqual(Variables.Global.Get("overallWidth"), myVariable);
}
[TestMethod]
public void Variables_ComputingAVariableValueResultsInACompoundVariable()
{
var compound = new Variable("x", 5) / 12;
string type = compound.GetType().ToString();
Assert.AreEqual("OSCADSharp.Scripting.CompoundVariable", type);
}
}
}