UnitTests.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using WSUniversalLib;
  4. namespace WSUniversalLibUnitTests
  5. {
  6. [TestClass]
  7. public class UnitTests
  8. {
  9. Calculation calculationClass = new Calculation();
  10. [TestMethod]
  11. public void GetPriorityForAgent_NonExistentAgentType()
  12. {
  13. int result = calculationClass.GetPriorityForAgent(5, 25, 1.6f);
  14. Assert.AreEqual(-1, result);
  15. }
  16. [TestMethod]
  17. public void GetPriorityForAgent_UnrealAge()
  18. {
  19. int result = calculationClass.GetPriorityForAgent(2, 999, 1.6f);
  20. Assert.AreEqual(-1, result);
  21. }
  22. [TestMethod]
  23. public void GetPriorityForAgent_ExperienceMoreThanAge()
  24. {
  25. int result = calculationClass.GetPriorityForAgent(1, 25, 50);
  26. Assert.AreEqual(-1, result);
  27. }
  28. [TestMethod]
  29. public void GetPriorityForAgent_ExperienceIsZero()
  30. {
  31. int result = calculationClass.GetPriorityForAgent(1, 25, 0);
  32. Assert.AreEqual(-1, result);
  33. }
  34. [TestMethod]
  35. public void GetPriorityForAgent_AgeIsZero()
  36. {
  37. int result = calculationClass.GetPriorityForAgent(1, 0, 5);
  38. Assert.AreEqual(-1, result);
  39. }
  40. [TestMethod]
  41. public void GetPriorityForAgent_SimpleValues_01()
  42. {
  43. int result = calculationClass.GetPriorityForAgent(1, 30, 3);
  44. Assert.AreEqual(5, result);
  45. }
  46. [TestMethod]
  47. public void GetPriorityForAgent_SimpleValues_02()
  48. {
  49. int result = calculationClass.GetPriorityForAgent(3, 45, 13);
  50. Assert.AreEqual(60, result);
  51. }
  52. [TestMethod]
  53. public void GetPriorityForAgent_SimpleValues_03()
  54. {
  55. int result = calculationClass.GetPriorityForAgent(2, 35, 22);
  56. Assert.AreEqual(86, result);
  57. }
  58. [TestMethod]
  59. public void GetPriorityForAgent_SimpleValues_04()
  60. {
  61. int result = calculationClass.GetPriorityForAgent(1, 20, 1);
  62. Assert.AreEqual(2, result);
  63. }
  64. [TestMethod]
  65. public void GetPriorityForAgent_SimpleValues_05()
  66. {
  67. int result = calculationClass.GetPriorityForAgent(3, 23, 2);
  68. Assert.AreEqual(9, result);
  69. }
  70. [TestMethod]
  71. public void GetPriorityForAgent_FloatValues_01()
  72. {
  73. int result = calculationClass.GetPriorityForAgent(1, 25, 2.7f);
  74. Assert.AreEqual(5, result);
  75. }
  76. [TestMethod]
  77. public void GetPriorityForAgent_FloatValues_02()
  78. {
  79. int result = calculationClass.GetPriorityForAgent(2, 62, 40.6f);
  80. Assert.AreEqual(166, result);
  81. }
  82. [TestMethod]
  83. public void GetPriorityForAgent_FloatValues_03()
  84. {
  85. int result = calculationClass.GetPriorityForAgent(3, 68, 47.6f);
  86. Assert.AreEqual(238, result);
  87. }
  88. [TestMethod]
  89. public void GetPriorityForAgent_FloatValues_04()
  90. {
  91. int result = calculationClass.GetPriorityForAgent(2, 29, 8.3f);
  92. Assert.AreEqual(27, result);
  93. }
  94. [TestMethod]
  95. public void GetPriorityForAgent_FloatValues_05()
  96. {
  97. int result = calculationClass.GetPriorityForAgent(1, 25, 2.5f);
  98. Assert.AreEqual(5, result);
  99. }
  100. }
  101. }