|
@@ -0,0 +1,151 @@
|
|
|
+using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
+using System;
|
|
|
+
|
|
|
+namespace WSUniversalLib.Tests
|
|
|
+{
|
|
|
+ [TestClass()]
|
|
|
+ public class CalculationTests
|
|
|
+ {
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProductTest()
|
|
|
+ {
|
|
|
+ int rez = 114148;
|
|
|
+ Calculation first = new Calculation();
|
|
|
+ int zn = first.GetQuantityForProduct(3, 1, 15, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_NonExistentProductType()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation second = new Calculation();
|
|
|
+ int zn = second.GetQuantityForProduct(0, 1, 15, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_NonExistentMaterialType()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation third = new Calculation();
|
|
|
+ int zn = third.GetQuantityForProduct(3, 0, 15, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_NegativeProductType()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation fourth = new Calculation();
|
|
|
+ int zn = fourth.GetQuantityForProduct(-1, 1, 15, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_NegativeMaterialType()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation fifth = new Calculation();
|
|
|
+ int zn = fifth.GetQuantityForProduct(3, -1, 15, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_NegativeWidth()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation sixth = new Calculation();
|
|
|
+ int zn = sixth.GetQuantityForProduct(3, 1, 15, -20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_NegativeLength()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation seventh = new Calculation();
|
|
|
+ int zn = seventh.GetQuantityForProduct(3, 1, 15, 20, -45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_NegativeCount()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation eighth = new Calculation();
|
|
|
+ int zn = eighth.GetQuantityForProduct(3, 1, -15, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_NonExistentCount()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation ninth = new Calculation();
|
|
|
+ int zn = ninth.GetQuantityForProduct(3, 1, 0, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_CountParseInt()
|
|
|
+ {
|
|
|
+ int rez = 38050;
|
|
|
+ Calculation tenth = new Calculation();
|
|
|
+ uint count = 5;
|
|
|
+ int parseCount = (int)count;
|
|
|
+ int zn = tenth.GetQuantityForProduct(3, 1, parseCount, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_CountCharSpace()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation eleventh = new Calculation();
|
|
|
+ char count = ' ';
|
|
|
+ int parseCount = (int)count;
|
|
|
+ int zn = eleventh.GetQuantityForProduct(3, 1, parseCount, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_CountCharRandom()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation twelfth = new Calculation();
|
|
|
+ char count = 's';
|
|
|
+ int parseCount = (int)count;
|
|
|
+ int zn = twelfth.GetQuantityForProduct(3, 1, parseCount, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_CountString()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation thirteenth = new Calculation();
|
|
|
+ string count = "str";
|
|
|
+ int convertCount = Convert.ToInt32(count);
|
|
|
+ int zn = thirteenth.GetQuantityForProduct(3, 1, convertCount, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_CountObj()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation testObj = new Calculation();
|
|
|
+ Calculation fourteenth = new Calculation();
|
|
|
+
|
|
|
+ int convertCount = Convert.ToInt32(testObj);
|
|
|
+ int zn = fourteenth.GetQuantityForProduct(3, 1, convertCount, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+ [TestMethod()]
|
|
|
+ public void GetQuantityForProduct_CountMasInt()
|
|
|
+ {
|
|
|
+ int rez = -1;
|
|
|
+ Calculation fourteenth = new Calculation();
|
|
|
+ int[] nums5 = { 5 };
|
|
|
+ int convertCount = Convert.ToInt32(nums5);
|
|
|
+ int zn = fourteenth.GetQuantityForProduct(3, 1, convertCount, 20, 45);
|
|
|
+ Assert.AreEqual(rez, zn);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|