UnitTest1.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using WSUniversalLib;
  4. namespace UnitTest
  5. {
  6. [TestClass]
  7. public class UnitTest1
  8. {
  9. Calculation calculation = new Calculation();
  10. [TestMethod]
  11. public void GetQuantityForProduct_DateExample()
  12. {
  13. int ex = 5;
  14. int ans = calculation.GetPriorityForAgent(2, 23, (float)1.5);
  15. Assert.AreEqual(ex, ans);
  16. }
  17. [TestMethod]
  18. public void GetQuantityForProduct_ExperienceMoreAge()
  19. {
  20. int ex = -1;
  21. int ans = calculation.GetPriorityForAgent(2, 23, 30);
  22. Assert.AreEqual(ex, ans);
  23. }
  24. [TestMethod]
  25. public void GetQuantityForProduct_OldSpecialistWithLittleExperience()
  26. {
  27. int ex = 3;
  28. int ans = calculation.GetPriorityForAgent(1, 40, (float)1.5);
  29. Assert.AreEqual(ex, ans);
  30. }
  31. [TestMethod]
  32. public void GetQuantityForProduct_YungSpecialist()
  33. {
  34. int ex = 3;
  35. int ans = calculation.GetPriorityForAgent(1, 23, (float)1.5);
  36. Assert.AreEqual(ex, ans);
  37. }
  38. [TestMethod]
  39. public void GetQuantityForProduct__NonExistentAgentType()
  40. {
  41. int ex = -1;
  42. int ans = calculation.GetPriorityForAgent(9, 23, (float)1.5);
  43. Assert.AreEqual(ex, ans);
  44. }
  45. [TestMethod]
  46. public void GetQuantityForProduct__NonExistentAge()
  47. {
  48. int ex = -1;
  49. int ans = calculation.GetPriorityForAgent(1, -2, (float)1.5);
  50. Assert.AreEqual(ex, ans);
  51. }
  52. [TestMethod]
  53. public void GetQuantityForProduct__NonExistentExperience()
  54. {
  55. int ex = -1;
  56. int ans = calculation.GetPriorityForAgent(1, 23, -2);
  57. Assert.AreEqual(ex, ans);
  58. }
  59. [TestMethod]
  60. public void GetQuantityForProduct_IsNotNullRezult()
  61. {
  62. Assert.IsNotNull(calculation.GetPriorityForAgent(2, 23, (float)1.5));
  63. }
  64. [TestMethod]
  65. public void GetQuantityForProduct_IntRezult()
  66. {
  67. Assert.IsInstanceOfType(calculation.GetPriorityForAgent(2, 23, (float)1.5), typeof(int));
  68. }
  69. [TestMethod]
  70. public void GetQuantityForProduct_NullExperience()
  71. {
  72. int ex = -1;
  73. int ans = calculation.GetPriorityForAgent(Convert.ToInt32(null), 23, -2);
  74. Assert.AreEqual(ex, ans);
  75. }
  76. [TestMethod]
  77. public void GetQuantityForProduct_NullAge()
  78. {
  79. int ex = -1;
  80. int ans = calculation.GetPriorityForAgent(1, Convert.ToInt32(null), -2);
  81. Assert.AreEqual(ex, ans);
  82. }
  83. [TestMethod]
  84. public void GetQuantityForProduct_NullAgentTypet()
  85. {
  86. int ex = -1;
  87. int ans = calculation.GetPriorityForAgent(1, 23, Convert.ToInt32(null));
  88. Assert.AreEqual(ex, ans);
  89. }
  90. [TestMethod]
  91. public void GetQuantityForProduct_BigExperience()
  92. {
  93. int ex = -1;
  94. int ans = calculation.GetPriorityForAgent(900000000, 23, -2);
  95. Assert.AreEqual(ex, ans);
  96. }
  97. [TestMethod]
  98. public void GetQuantityForProduct_BigAge()
  99. {
  100. int ex = -1;
  101. int ans = calculation.GetPriorityForAgent(1, 9000000000000000000, -2);
  102. Assert.AreEqual(ex, ans);
  103. }
  104. [TestMethod]
  105. public void GetQuantityForProduct_BiggentTypet()
  106. {
  107. int ex = -1;
  108. int ans = calculation.GetPriorityForAgent(1, 23, 9000000000000000000);
  109. Assert.AreEqual(ex, ans);
  110. }
  111. }
  112. }