| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System.Diagnostics;
- using IwbZero.Expr;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using WeEngine.ComponentInfo;
- namespace WeEngine.Tests.Expr
- {
- [TestClass]
- public class ExprTest
- {
- private string Result { get; set; }
- [TestMethod]
- public void Test1()
- {
- var exprStr = "2+4";
- Result = EvalExpr.Evaluate(exprStr);
- Debug.WriteLine(Result);
- }
-
- [TestMethod]
- public void Test4()
- {
- #region IFunSubStr
- {
- var exprStr = "IFunSubStr('12345678','1')";
- Result = EvalExpr.Evaluate(exprStr);
- }
- {
- var exprStr = "IFunSubStr('12345678','1','2')";
- Result = EvalExpr.Evaluate(exprStr);
- }
- {
- var exprStr = "IFunSubStr('12345678','2','3','r')";
- Result = EvalExpr.Evaluate(exprStr);
- }
- {
- var exprStr = "IFunSubStr('12345678','3','r')";
- Result = EvalExpr.Evaluate(exprStr);
- }
- #endregion IFunSubStr
- {
- var exprStr = "IFunFormatStr('123{0}4567{1}8','q','w')";
- Result = EvalExpr.Evaluate(exprStr);
- }
- {
- var exprStr = "IFunGetDate()";
- Result = EvalExpr.Evaluate(exprStr);
- }
- {
- var exprStr = "IFunGetDay('2020-03-19')";
- Result = EvalExpr.Evaluate(exprStr);
- }
- {
- var exprStr = "IFunDiffD(\"2020-03-12\",\"2020-03-19\")";
- Result = EvalExpr.Evaluate(exprStr);
- }
- }
- [TestMethod]
- public void T()
- {
- var cs1 = new ComponentScript().ModelFrom(s1.Trim());
- var cs2 = new ComponentScript().ModelFrom(s11.Trim());
- var cs3 = new ComponentScript().ModelFrom(s2.Trim());
- var cs4 = new ComponentScript().ModelFrom(s21.Trim());
- }
- private string s1 =
- "<ComponentScript><CpSetVariables id=\"1\"><Variable><Name>Date</Name><Value>@@Date</Value></Variable><CompType>CpSetVariables</CompType><Name>1</Name></CpSetVariables><CpSetVariables id=\"2\"><Variable><Name>TFName</Name><Value>@@TFName</Value></Variable><CompType>CpSetVariables</CompType><Name>2</Name></CpSetVariables></ComponentScript>";
- private string s11 =
- "<CpSetVariables id=\"1\"><Variable><Name>Date</Name><Value> @@Date</Value></Variable><CompType>CpSetVariables</CompType><Name>1</Name></CpSetVariables><CpSetVariables id=\"2\"><Variable><Name>TFName</Name><Value> @@TFName</Value></Variable><CompType>CpSetVariables</CompType><Name>2</Name></CpSetVariables>";
- private string s2 =
- "<ComponentScript><CpNodeToWait id=\"1\"><CompType>CpNodeToWait</CompType><Name>1</Name><WaitNodes>P_R1_SFB2_JY002000000310_FN1</WaitNodes></CpNodeToWait></ComponentScript>";
- private string s21 =
- "<CpNodeToWait id=\"1\"><CompType>CpNodeToWait</CompType><Name>1</Name><WaitNodes>P_R1_SFB2_JY002000000310_FN1</WaitNodes></CpNodeToWait>";
- }
- }
|