12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using AutoServiceSultik.Entites;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- using System.Linq;
- namespace ServiceUnitTest
- {
- [TestClass]
- public class ServiceUnitTest1
- {
- [TestMethod]
- public void TestMethod_1()
- {
- string name = "";
- string costr = "200";
- string discount = "5";
- var r = ServiceValidationTestingMethod.CheckErrors(name, costr, discount);
- Assert.AreEqual("Название услуги обязательно для заполнения;", r.ToString().Trim());
- }
- [TestMethod]
- public void TestMethod_2()
- {
- string name = "Замена жидкости в кондиционере";
- string costr = "200";
- string discount = "5";
- var r = ServiceValidationTestingMethod.CheckErrors(name, costr, discount);
- Assert.AreEqual("Такая услуга уже существует;", r.ToString().Trim());
- }
- [TestMethod]
- public void TestMethod_3()
- {
- string name = "Замена жидкости";
- string costr = "-2";
- string discount = "5";
- var r = ServiceValidationTestingMethod.CheckErrors(name, costr, discount);
- Assert.AreEqual("Стоимость услуги должно быть положительное число;", r.ToString().Trim());
- }
- [TestMethod]
- public void TestMethod_4()
- {
- string name = "Замена жидкости";
- string costr = "200";
- string discount = "111";
- var r = ServiceValidationTestingMethod.CheckErrors(name, costr, discount);
- Assert.AreEqual("Размер скидки - целое число в диапазоне от 0 до 100%", r.ToString().Trim());
- }
- }
- }
|