UnitTest1.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using WSUniversalLib;
  4. namespace UnitTestProject1
  5. {
  6. [TestClass]
  7. public class UnitTest1
  8. {
  9. Calculation cl = new Calculation();
  10. [TestMethod]
  11. public void GetPriorityFirstClass_YoungAgent()
  12. {
  13. int i = cl.GetPriorityForAgent(1, 10, 2);
  14. Assert.AreEqual(4, i);
  15. }
  16. [TestMethod]
  17. public void GetPriorityFirstClass_RegularAgent()
  18. {
  19. int i = cl.GetPriorityForAgent(1, 25, 4);
  20. Assert.AreEqual(7, i);
  21. }
  22. [TestMethod]
  23. public void GetPriorityFirstClass_ExpiriencedAgent_First()
  24. {
  25. int i = cl.GetPriorityForAgent(1, 10, 11);
  26. Assert.AreEqual(25, i);
  27. }
  28. [TestMethod]
  29. public void GetPriorityFirstClass_ExpiriencedAgent_Second()
  30. {
  31. int i = cl.GetPriorityForAgent(1, 10, 22);
  32. Assert.AreEqual(55, i);
  33. }
  34. [TestMethod]
  35. public void GetPriorityFirstClass_ExpiriencedAgent_Third()
  36. {
  37. int i = cl.GetPriorityForAgent(1, 10, 44);
  38. Assert.AreEqual(110, i);
  39. }
  40. [TestMethod]
  41. public void GetPrioritySecondClassAgent()
  42. {
  43. int i = cl.GetPriorityForAgent(2, 26, 4);
  44. Assert.AreEqual(13, i);
  45. }
  46. [TestMethod]
  47. public void GetPriorityThirdClassAgent()
  48. {
  49. int i = cl.GetPriorityForAgent(3, 26, 4);
  50. Assert.AreEqual(16, i);
  51. }
  52. [TestMethod]
  53. public void GetPrioritySecondClass_YoungAgent()
  54. {
  55. int i = cl.GetPriorityForAgent(2, 10, 2);
  56. Assert.AreEqual(7, i);
  57. }
  58. [TestMethod]
  59. public void GetPriorityThirdClass_YoungAgent()
  60. {
  61. int i = cl.GetPriorityForAgent(3, 10, 2);
  62. Assert.AreEqual(9, i);
  63. }
  64. [TestMethod]
  65. public void GetPrioritySecondClass_ExperiencedAgent()
  66. {
  67. int i = cl.GetPriorityForAgent(2, 10, 11);
  68. Assert.AreEqual(41, i);
  69. }
  70. [TestMethod]
  71. public void GetPriority_WrondClass()
  72. {
  73. int i = cl.GetPriorityForAgent(-1, 10, 11);
  74. Assert.AreEqual(-1, i);
  75. }
  76. [TestMethod]
  77. public void GetPriority_WrongAge()
  78. {
  79. int i = cl.GetPriorityForAgent(2, -1, 11);
  80. Assert.AreEqual(-1, i);
  81. }
  82. [TestMethod]
  83. public void GetPriority_WrongExpirience()
  84. {
  85. int i = cl.GetPriorityForAgent(2, 10, -1);
  86. Assert.AreEqual(-1, i);
  87. }
  88. [TestMethod]
  89. public void GetPriority_CalculatingClass()
  90. {
  91. int i = cl.GetPriorityForAgent(4-2, 10, 11);
  92. Assert.AreEqual(41, i);
  93. }
  94. [TestMethod]
  95. public void GetPriority_WrongCalculatingClass()
  96. {
  97. int i = cl.GetPriorityForAgent(2-4, 10, 11);
  98. Assert.AreEqual(-1, i);
  99. }
  100. }
  101. }