|
@@ -1,14 +1,133 @@
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using System;
|
|
using System;
|
|
|
|
+using WSUniversalLib;
|
|
|
|
|
|
namespace UnitTests
|
|
namespace UnitTests
|
|
{
|
|
{
|
|
[TestClass]
|
|
[TestClass]
|
|
public class UnitTest1
|
|
public class UnitTest1
|
|
{
|
|
{
|
|
|
|
+ Calculation calculation = new Calculation();
|
|
[TestMethod]
|
|
[TestMethod]
|
|
- public void TestMethod1()
|
|
|
|
|
|
+ public void GetQuantityForProduct_CheckDLL()
|
|
{
|
|
{
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 23, (float)1.5);
|
|
|
|
+ int answer = 5;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckZeroType()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(0, 23, (float)1.5);
|
|
|
|
+ int answer = -1;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_ZeroAge()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 0, (float)1.5);
|
|
|
|
+ int answer = -1;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckZeroExp()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 23, 0);
|
|
|
|
+ int answer = -1;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckSame()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 23, (float)1.5);
|
|
|
|
+ int answer = calculation.GetPriorityForAgent(2, 23, (float)1.5); ;
|
|
|
|
+ Assert.AreNotSame(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckIsNotNull()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 23, (float)1.5);
|
|
|
|
+
|
|
|
|
+ Assert.IsNotNull(expect);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckTypeData()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 23, (float)1.5);
|
|
|
|
+
|
|
|
|
+ Assert.IsInstanceOfType(expect, typeof(int));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckBigIntType()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(200, 23, (float)1.5);
|
|
|
|
+ int answer = -1;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckBigIntAge()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 200, (float)1.5);
|
|
|
|
+ int answer = -1;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckBigFloat()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 23, (float)200);
|
|
|
|
+ int answer = -1;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckAllZero()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(0, 0, (float)0);
|
|
|
|
+ int answer = -1;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_ChecNotEqualType()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(1, 23, (float)1.5);
|
|
|
|
+ int answer = 4;
|
|
|
|
+ Assert.AreNotEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_NotEquaAge()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 1, (float)1.5);
|
|
|
|
+ int answer = 5;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_NotEualExp()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(2, 23, (float)1);
|
|
|
|
+ int answer = 3;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ [TestMethod]
|
|
|
|
+ public void GetQuantityForProduct_CheckPriority()
|
|
|
|
+ {
|
|
|
|
+ int expect = calculation.GetPriorityForAgent(3, 23, (float)1.5);
|
|
|
|
+ int answer = 7;
|
|
|
|
+ Assert.AreEqual(expect, answer);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|