UnitTest1.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using WSUniversalLib;
  4. namespace UnitTestorWSULib
  5. {
  6. [TestClass]
  7. public class UnitTest1
  8. {
  9. //1//
  10. [TestMethod]
  11. public void ResultEqualCorrect()
  12. {
  13. Assert.AreEqual(114147, Calculation.GetQuantityForProduct(3, 1, 15, 20, 45));
  14. }
  15. [TestMethod]
  16. public void ResultIsNotNull()
  17. {
  18. Assert.IsNotNull(Calculation.GetQuantityForProduct(3, 1, 17, 39, 15));
  19. }
  20. [TestMethod]
  21. public void BadResultProductEqualCorrect()
  22. {
  23. Assert.AreEqual(-1, Calculation.GetQuantityForProduct(4, 1, 20, 21, 46));
  24. }
  25. [TestMethod]
  26. public void IsIncorrectType()
  27. {
  28. Assert.IsNotInstanceOfType(Calculation.GetQuantityForProduct(2, 7, 19, 21, 39), typeof(double));
  29. }
  30. [TestMethod]
  31. public void IsCorrectType()
  32. {
  33. Assert.IsInstanceOfType(Calculation.GetQuantityForProduct(2, 7, 19, 21, 39), typeof(int));
  34. }
  35. }
  36. }