1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- using WSUniversalLib;
- namespace WSUniversalLibUnitTest
- {
- [TestClass]
- public class UnitTest1
- {
- //Тесты низкой сложности
- [TestMethod]
- public void GetQuantityForProductTest_IsInstanceOfType()
- {
- int answer = Calculation.GetQuantityForProduct(3, 1, 15, 20, 45);
- Assert.IsInstanceOfType(answer, typeof(int));
- }
- [TestMethod]
- public void GetQuantityForProductTest_IsNotInstanceOfType()
- {
- int answer = Calculation.GetQuantityForProduct(3, 1, 15, 20, 45);
- Assert.IsNotInstanceOfType(answer, typeof(double));
- }
- [TestMethod]
- public void GetQuantityForProductTest_IsNotNull()
- {
- int answer = Calculation.GetQuantityForProduct(3, 1, 15, 20, 45);
- Assert.IsNotNull(answer);
- }
- [TestMethod]
- public void GetQuantityForProductTest_AreEqual()
- {
- int answer = Calculation.GetQuantityForProduct(3, 1, 15, 20, 45);
- Assert.AreEqual(114146, answer);
- }
- [TestMethod]
- public void GetQuantityForProductTest_AreNotEqual()
- {
- int answer = Calculation.GetQuantityForProduct(3, 1, 15, 20, 45);
- Assert.AreNotEqual(12, answer);
- }
- //Тесты высокой сложности
- [TestMethod]
- public void GetQuantityForProductTest_ProductDoesNotExist()
- {
- int answer = Calculation.GetQuantityForProduct(21, 1, 15, 20, 45);
- Assert.AreEqual(-1, answer);
- }
- [TestMethod]
- public void GetQuantityForProductTest_MaterialDoesNotExist()
- {
- int answer = Calculation.GetQuantityForProduct(3, 21, 15, 20, 45);
- Assert.AreEqual(-1, answer);
- }
- [TestMethod]
- public void GetQuantityForProductTest_WidthDoesNotExist()
- {
- int answer = Calculation.GetQuantityForProduct(3, 1, 15, 0, 45);
- Assert.AreEqual(-1, answer);
- }
- [TestMethod]
- public void GetQuantityForProductTest_CountDoesNotExist()
- {
- int answer = Calculation.GetQuantityForProduct(3, 1, 0, 20, 45);
- Assert.AreEqual(-1, answer);
- }
- [TestMethod]
- public void GetQuantityForProductTest_LenghtDoesNotExist()
- {
- int answer = Calculation.GetQuantityForProduct(3, 1, 15, 20, 0);
- Assert.AreEqual(-1, answer);
- }
- }
- }
|