123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- using WSUniversalLib;
- namespace WSUniversalTest
- {
- [TestClass]
- public class UnitTest1
- {
- [TestMethod]
- public void GetQuantityForProduct_IsTrue()
- {
- int result = Calculation.GetQuantityForProduct(2, 1, 10, 20f, 45f);
- Assert.IsTrue(result > 0);
- }
- [TestMethod]
- public void GetQuantityForProduct_IsTrue2()
- {
- int result = Calculation.GetQuantityForProduct(2, 2, 10, 20f, 45f);
- Assert.IsTrue(result == 22527);
- }
- [TestMethod]
- public void GetQuantityForProduct_IsTrue3()
- {
- int result = Calculation.GetQuantityForProduct(1, 2, 10, 20f, 45f);
- Assert.IsTrue(result == 9912);
- }
- [TestMethod]
- public void GetQuantityForProduct_IsTrue4()
- {
- int result = Calculation.GetQuantityForProduct(1, 1, 10, 20f, 45f);
- Assert.IsTrue(result == 9930);
- }
- [TestMethod]
- public void GetQuantityForProduct_IsFalse()
- {
- int result = Calculation.GetQuantityForProduct(1, 1, 10, 20f, 45f);
- Assert.IsFalse(result == 114146);
- }
- [TestMethod]
- public void GetQuantityForProduct_TypeOfResultIsInt()
- {
- Assert.IsInstanceOfType(Calculation.GetQuantityForProduct(1, 2, 1, 15f, 13f), typeof(int));
- }
- [TestMethod]
- public void GetQuantityForProduct_AreEquel()
- {
- int result = Calculation.GetQuantityForProduct(3, 1, 15, 20f, 45f);
- Assert.AreEqual(Convert.ToString(result), "114147");
- }
- [TestMethod]
- public void GetQuantityForProduct_AreEquel2()
- {
- int result = Calculation.GetQuantityForProduct(2, 2, 10, 20f, 45f);
- Assert.AreEqual(Convert.ToString(result), "22527");
- }
- [TestMethod]
- public void GetQuantityForProduct_AreNotEquel()
- {
- int result = Calculation.GetQuantityForProduct(3, 1, 15, 20f, 45f);
- Assert.AreNotEqual(Convert.ToString(result), "114146");
- }
- [TestMethod]
- public void GetQuantityForProduct_IsNotNULL()
- {
- Assert.IsNotNull(Calculation.GetQuantityForProduct(2, 1, 10, 20f, 45f));
- }
- [TestMethod]
- public void GetQuantityForProduct_UNCorrectProductType_IsTrue()
- {
- int result = Calculation.GetQuantityForProduct(0, 2, 1, 15f, 13f);
- Assert.IsTrue(result == -1);
- }
- [TestMethod]
- public void GetQuantityForProduct_UNCorrectMaterialType_IsTrue()
- {
- int result = Calculation.GetQuantityForProduct(1, 0, 1, 15f, 13f);
- Assert.IsTrue(result == -1);
- }
- [TestMethod]
- public void GetQuantityForProduct_UNCorrectCount_IsTrue()
- {
- int result = Calculation.GetQuantityForProduct(1, 2, 0, 15f, 13f);
- Assert.IsTrue(result == -1);
- }
- [TestMethod]
- public void GetQuantityForProduct_UNCorrectWidth_IsTrue()
- {
- int result = Calculation.GetQuantityForProduct(1, 2, 1, 0f, 13f);
- Assert.IsTrue(result == -1);
- }
- [TestMethod]
- public void GetQuantityForProduct_UNCorrectLength_IsTrue()
- {
- int result = Calculation.GetQuantityForProduct(1, 2, 0, 15f, 0f);
- Assert.IsTrue(result == -1);
- }
- }
- }
|