123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- using WSUniversalLib;
- namespace UnitTestorWSULib
- {
- [TestClass]
- public class UnitTest1
- {
- #region Простые
- [TestMethod]
- public void ResultEqualCorrect()
- {
- Assert.AreEqual(114147,Calculation.GetQuantityForProduct(3,1,15,20,45));
- }
- [TestMethod]
- public void ResultEqualNotCorrect()
- {
- Assert.AreNotEqual(114148, Calculation.GetQuantityForProduct(3, 1, 20, 21, 46));
- }
- [TestMethod]
- public void ResultIsNotNull()
- {
- Assert.IsNotNull(Calculation.GetQuantityForProduct(3, 1, 15, 45, 13));
- }
- [TestMethod]
- public void BadResultProductEqualCorrect()
- {
- Assert.AreEqual(-1, Calculation.GetQuantityForProduct(4, 1, 20, 21, 46));
- }
- [TestMethod]
- public void BadResultMaterialEqualCorrect()
- {
- Assert.AreEqual(-1, Calculation.GetQuantityForProduct(3, 5, 20, 21, 46));
- }
- [TestMethod]
- public void IsCorrectType()
- {
- Assert.IsInstanceOfType(Calculation.GetQuantityForProduct(3, 5, 20, 21, 46), typeof(int));
- }
- [TestMethod]
- public void IsIncorrectType()
- {
- Assert.IsNotInstanceOfType(Calculation.GetQuantityForProduct(3, 5, 20, 21, 46), typeof(double));
- }
- [TestMethod]
- public void ResultNotEqualIncorrect()
- {
- Assert.AreNotEqual(-1, Calculation.GetQuantityForProduct(3, 1, 20, 21, 46));
- }
- [TestMethod]
- public void ResultEqualIncorrect()
- {
- Assert.AreEqual(-1, Calculation.GetQuantityForProduct(4, 4, 20, 21, 46));
- }
- [TestMethod]
- public void BadResultIsType()
- {
- Assert.IsInstanceOfType(Calculation.GetQuantityForProduct(4, 4, 20, 21, 46), typeof(int));
- }
- #endregion
- #region Сложные
- [TestMethod]
- public void ThrowThirdArgException()
- {
- Assert.ThrowsException<ArgumentException>(()=>Calculation.GetQuantityForProduct(1, 1, -1, 1, 1));
- }
- [TestMethod]
- public void ThrowFourthArgException()
- {
- Assert.ThrowsException<ArgumentException>(() => Calculation.GetQuantityForProduct(1, 1, 1, -1, 1));
- }
- [TestMethod]
- public void ThrowFifthArgException()
- {
- Assert.ThrowsException<ArgumentException>(() => Calculation.GetQuantityForProduct(1, 1, 1, 1, -11));
- }
- [TestMethod]
- public void ThrowTwoArgException()
- {
- Assert.ThrowsException<ArgumentException>(() => Calculation.GetQuantityForProduct(1, 1, 1, -1, -11));
- }
- [TestMethod]
- public void ThrowThreeArgException()
- {
- Assert.ThrowsException<ArgumentException>(() => Calculation.GetQuantityForProduct(1, 1, -1, -1, -11));
- }
- #endregion
- }
- }
|