ServiceUnitTest1.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using AutoServiceSultik.Entites;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using System;
  4. using System.Linq;
  5. namespace ServiceUnitTest
  6. {
  7. [TestClass]
  8. public class ServiceUnitTest1
  9. {
  10. [TestMethod]
  11. public void TestMethod_1()
  12. {
  13. string name = "";
  14. string costr = "200";
  15. string discount = "5";
  16. var r = ServiceValidationTestingMethod.CheckErrors(name, costr, discount);
  17. Assert.AreEqual("Название услуги обязательно для заполнения;", r.ToString().Trim());
  18. }
  19. [TestMethod]
  20. public void TestMethod_2()
  21. {
  22. string name = "Замена жидкости в кондиционере";
  23. string costr = "200";
  24. string discount = "5";
  25. var r = ServiceValidationTestingMethod.CheckErrors(name, costr, discount);
  26. Assert.AreEqual("Такая услуга уже существует;", r.ToString().Trim());
  27. }
  28. [TestMethod]
  29. public void TestMethod_3()
  30. {
  31. string name = "Замена жидкости";
  32. string costr = "-2";
  33. string discount = "5";
  34. var r = ServiceValidationTestingMethod.CheckErrors(name, costr, discount);
  35. Assert.AreEqual("Стоимость услуги должно быть положительное число;", r.ToString().Trim());
  36. }
  37. [TestMethod]
  38. public void TestMethod_4()
  39. {
  40. string name = "Замена жидкости";
  41. string costr = "200";
  42. string discount = "111";
  43. var r = ServiceValidationTestingMethod.CheckErrors(name, costr, discount);
  44. Assert.AreEqual("Размер скидки - целое число в диапазоне от 0 до 100%", r.ToString().Trim());
  45. }
  46. }
  47. }