UnitTest1.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using Servise.Classes;
  3. using Servise.Forms;
  4. namespace Test
  5. {
  6. [TestClass]
  7. public class UnitTest1
  8. {
  9. [TestMethod]
  10. public void proverkazapolnenia()
  11. {
  12. string log = "";
  13. string pass = "";
  14. bool ex = false;
  15. UserInform userInform = new UserInform();
  16. bool act = userInform.Avtoriz(log, pass);
  17. Assert.AreEqual(ex, act);
  18. }
  19. [TestMethod]
  20. public void provVhoda()
  21. {
  22. string log = "admin";
  23. string pass = "admin".GetHashCode().ToString();
  24. bool ex = true;
  25. UserInform userInform = new UserInform();
  26. bool act = userInform.Avtoriz(log, pass);
  27. Assert.AreEqual(ex, act);
  28. }
  29. public void provbezpar()
  30. {
  31. string log = "111";
  32. string pass = "";
  33. bool ex = false;
  34. UserInform userInform = new UserInform();
  35. bool act = userInform.Avtoriz(log, pass);
  36. Assert.AreEqual(ex, act);
  37. }
  38. public void provbezlog()
  39. {
  40. string log = "";
  41. string pass = "111";
  42. bool ex = false;
  43. UserInform userInform = new UserInform();
  44. bool act = userInform.Avtoriz(log, pass);
  45. Assert.AreEqual(ex, act);
  46. }
  47. [TestMethod]
  48. public void stoimprav()// подсчет стоимости детали
  49. {
  50. AddZac c = new AddZac();
  51. Assert.AreEqual(c.podschet(2, 4), 680);
  52. }
  53. [TestMethod]
  54. public void stoinemprav()// подсчет стоимости детали
  55. {
  56. AddZac c = new AddZac();
  57. Assert.AreEqual(c.podschet(2, 4), 580);
  58. }
  59. [TestMethod]
  60. public void validmail()
  61. {
  62. string log = "dreyvania999@gmail.com";
  63. bool ex = true;
  64. Main main = new Main();
  65. bool act = main.IsValidEmail(log);
  66. Assert.AreEqual(ex, act);
  67. }
  68. [TestMethod]
  69. public void unvalidmail()
  70. {
  71. string log = "dreyvania999-gmail.ru";
  72. bool ex = false;
  73. Main main = new Main();
  74. bool act = main.IsValidEmail(log);
  75. Assert.AreEqual(ex, act);
  76. }
  77. }
  78. }