UnitTest1.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using System.Windows.Forms;
  4. using hospital;
  5. namespace unitTests
  6. {
  7. [TestClass]
  8. public class UnitTest1
  9. {
  10. [TestMethod]
  11. public void analgin100_add1True()
  12. {
  13. string nameDrug = "Анальгин";
  14. int priceDrug = 100;
  15. string expected = insertDrug.AddDrug(nameDrug, priceDrug);
  16. string act = "Добавление данных произошло успешно";
  17. Assert.AreEqual(act, expected);
  18. }
  19. [TestMethod]
  20. public void analgin100_add2False()
  21. {
  22. string nameDrug = "Анальгин";
  23. int priceDrug = 100;
  24. string expected = insertDrug.AddDrug(nameDrug, priceDrug);
  25. string act = "Добавление данных произошло успешно";
  26. Assert.AreNotEqual(act, expected);
  27. }
  28. [TestMethod]
  29. public void analgin100_delete1True()
  30. {
  31. string nameDrug = "Анальгин";
  32. int priceDrug = 100;
  33. string expected = mainMenu.deleteDrug(nameDrug, priceDrug);
  34. string act = "Удаление прошло успешно";
  35. Assert.AreEqual(act, expected);
  36. }
  37. [TestMethod]
  38. public void analgin100_delete2False()
  39. {
  40. string nameDrug = "Анальгин";
  41. int priceDrug = 100;
  42. string expected = mainMenu.deleteDrug(nameDrug, priceDrug);
  43. string act = "Удаление прошло успешно";
  44. Assert.AreNotEqual(act,expected);
  45. }
  46. [TestMethod]
  47. public void patient_add1True()
  48. {
  49. string namePatient = "Морозов Андрей Вячеславович";
  50. string nameEmployee = "Сергеичев Артем Денисович";
  51. string Disease = "Простуда";
  52. string Severity = "Легкая";
  53. string expected = insertPatientCard.addPatient(namePatient, nameEmployee, Disease, Severity);
  54. string act = "Добавление данных произошло успешно";
  55. Assert.AreEqual(act, expected);
  56. }
  57. [TestMethod]
  58. public void patient_add2False()
  59. {
  60. string namePatient = "Морозов Андрей Вячеславович";
  61. string nameEmployee = "Сергечев Артем Денисович";
  62. string Disease = "Простуда";
  63. string Severity = "Легкая";
  64. string expected = insertPatientCard.addPatient(namePatient, nameEmployee, Disease, Severity);
  65. string act = "Добавление данных произошло успешно";
  66. Assert.AreNotEqual(act, expected);
  67. }
  68. [TestMethod]
  69. public void auth_admin1True()
  70. {
  71. string login = "admin";
  72. string password = "admin";
  73. string expected = auth.signIn(login,password);
  74. string act = "Добро пожаловать, админ!";
  75. Assert.AreEqual(act, expected);
  76. }
  77. [TestMethod]
  78. public void auth_admin2False()
  79. {
  80. string login = "amin";
  81. string password = "admin";
  82. string expected = auth.signIn(login, password);
  83. string act = "Добро пожаловать, админ!";
  84. Assert.AreNotEqual(act, expected);
  85. }
  86. [TestMethod]
  87. public void auth_user1True()
  88. {
  89. string login = "artem";
  90. string password = "artem";
  91. string expected = auth.signIn(login, password);
  92. string act = "Успешная авторизация!";
  93. Assert.AreEqual(act, expected);
  94. }
  95. [TestMethod]
  96. public void auth_user2False()
  97. {
  98. string login = "artem";
  99. string password = "artem231";
  100. string expected = auth.signIn(login, password);
  101. string act = "Успешная авторизация!!";
  102. Assert.AreNotEqual(act, expected);
  103. }
  104. }
  105. }