Skip to content

Commit 1452cb9

Browse files
committed
统一方法名,防出错
1 parent 0b95fb7 commit 1452cb9

File tree

3 files changed

+79
-79
lines changed

3 files changed

+79
-79
lines changed

csharp/ToolGood.Algorithm2.Test/AlgorithmEngineEx/AlgorithmEngineExTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void Test()
3737
Radius = 3
3838
};
3939
PriceAlgorithm priceAlgorithm = new PriceAlgorithm(multiConditionCache, desk);
40-
var p1 = priceAlgorithm.TryEvaluate("价格", 0.0);
40+
var p1 = priceAlgorithm.TryEvaluateCategory("价格", 0.0);
4141
Assert.AreEqual(3 * 3 * Math.PI * 1.5, p1, 0.0001);
4242

4343
Desk desk2 = new Desk() {
@@ -47,7 +47,7 @@ public void Test()
4747
Heigth = 1
4848
};
4949
priceAlgorithm = new PriceAlgorithm(multiConditionCache, desk2);
50-
var p2 = priceAlgorithm.TryEvaluate("价格", 0.0);
50+
var p2 = priceAlgorithm.TryEvaluateCategory("价格", 0.0);
5151
Assert.AreEqual(3 * 1.3 * 2 + 1 * 1.1, p2, 0.0001);
5252

5353

@@ -58,12 +58,12 @@ public void Test()
5858
Heigth = 1
5959
};
6060
priceAlgorithm = new PriceAlgorithm(multiConditionCache, desk3);
61-
var p3 = priceAlgorithm.TryEvaluate("价格", 0.0);
61+
var p3 = priceAlgorithm.TryEvaluateCategory("价格", 0.0);
6262
Assert.AreEqual(0, p3, 0.001);
6363
Assert.AreEqual("CategoryName [价格] is missing.", priceAlgorithm.LastError);
6464

6565

66-
var p4 = priceAlgorithm.TryEvaluate("出错了", 0.0);
66+
var p4 = priceAlgorithm.TryEvaluateCategory("出错了", 0.0);
6767

6868

6969
var tt = priceAlgorithm.EvaluateFormula("长-宽-高", '-');
@@ -96,7 +96,7 @@ public void Test2()
9696
Radius = 3
9797
};
9898
PriceAlgorithm priceAlgorithm = new PriceAlgorithm(multiConditionCache, desk);
99-
var p1 = priceAlgorithm.TryEvaluate("价格", 0.0);
99+
var p1 = priceAlgorithm.TryEvaluateCategory("价格", 0.0);
100100
Assert.AreEqual(3 * 3 * Math.PI * 1.5, p1, 0.0001);
101101

102102
Desk desk2 = new Desk() {
@@ -106,7 +106,7 @@ public void Test2()
106106
Heigth = 1
107107
};
108108
priceAlgorithm = new PriceAlgorithm(multiConditionCache, desk2);
109-
var p2 = priceAlgorithm.TryEvaluate("价格", 0.0);
109+
var p2 = priceAlgorithm.TryEvaluateCategory("价格", 0.0);
110110
Assert.AreEqual(3 * 1.3 * 2 + 1 * 1.1, p2, 0.0001);
111111

112112

@@ -117,12 +117,12 @@ public void Test2()
117117
Heigth = 1
118118
};
119119
priceAlgorithm = new PriceAlgorithm(multiConditionCache, desk3);
120-
var p3 = priceAlgorithm.TryEvaluate("价格", 0.0);
120+
var p3 = priceAlgorithm.TryEvaluateCategory("价格", 0.0);
121121
Assert.AreEqual(0, p3, 0.001);
122122
Assert.AreEqual("CategoryName [价格] is missing.", priceAlgorithm.LastError);
123123

124124

125-
var p4 = priceAlgorithm.TryEvaluate("出错了", 0.0);
125+
var p4 = priceAlgorithm.TryEvaluateCategory("出错了", 0.0);
126126

127127
}
128128
[Test]
@@ -168,7 +168,7 @@ public void Test4()
168168
algoEngine.AddParameter("宽", 1.3);
169169
algoEngine.AddParameter("高", 1);
170170

171-
var p2 = algoEngine.TryEvaluate("价格", 0.0);
171+
var p2 = algoEngine.TryEvaluateCategory("价格", 0.0);
172172
Assert.AreEqual(3 * 1.3 * 2 + 1 * 1.1, p2, 0.0001);
173173

174174
}

0 commit comments

Comments
 (0)