123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- using Kusach;
- namespace UnitTests
- {
- [TestClass]
- public class UnitTest1
- {
- [TestMethod]
- public void IsValidPhoneNumber()
- {
- string phoneNum = "9999194949";
- Assert.IsTrue(Functions.IsValidPhoneNumber(phoneNum));
- }
- [TestMethod]
- public void IsValidEmail()
- {
- string email = "lalka@gmail.com";
- Assert.IsTrue(Functions.IsValidEmail(email));
- }
- [TestMethod]
- public void PasswordEncryptTest()
- {
- string password = "lalka";
- string expected = "55B6F08EFCE1438F38323E02C7C451FBD1E1AA12";
- Assert.AreEqual(Encrypt.GetHash(password), expected);
- }
- [TestMethod]
- public void LoginTest()
- {
- string login = "qq";
- string password = "qq";
- Assert.IsTrue(Functions.LoginCheck(login, password));
- }
- [TestMethod]
- public void IsValidLoginAndPassword()
- {
- Assert.IsTrue(Functions.IsValidLogAndPass("qq", "ww"));
- Assert.IsTrue(Functions.IsValidLogAndPass("laq", "wwadsw"));
- Assert.IsFalse(Functions.IsValidLogAndPass("", ""));
- Assert.IsFalse(Functions.IsValidLogAndPass("", "SimplePass"));
- Assert.IsFalse(Functions.IsValidLogAndPass("SimpleLogin", ""));
- }
- [TestMethod]
- public void IsLoginAlreadyTaken()
- {
- Assert.IsTrue(Functions.IsLoginAlreadyTaken("qq"));
- }
- [TestMethod]
- public void GetNameOfTransportUsingId()
- {
- int transportId = 1;
- string expected = "Avtobus";
- Assert.AreEqual(Functions.GetNameOfTransport(transportId), expected);
- }
- [TestMethod]
- public void GetNumberPlateUsingId()
- {
- int transportId = 1;
- string expected = "AA333AA78";
- Assert.AreEqual(Functions.GetNumberPlate(transportId), expected);
- }
- [TestMethod]
- public void GetRouteNameUsingId()
- {
- int routeId = 1;
- string expected = "Маршрут #1";
- Assert.AreEqual(Functions.GetRouteName(routeId), expected);
- }
- [TestMethod]
- public void GetNameOfPointUsingId()
- {
- int pointId = 1;
- string expected = "Томская";
- Assert.AreEqual(Functions.GetNameOfPoint(pointId), expected);
- }
- [TestMethod]
- public void GetLocationOfPointUsingId()
- {
- int pointId = 1;
- string expected = "Томская, 21";
- Assert.AreEqual(Functions.GetLocationOfPoint(pointId), expected);
- }
- [TestMethod]
- public void IsValidNameAndLocationOfPoint()
- {
- string Name = "Томская";
- string Location = "Томская, 21";
- Assert.IsTrue(Functions.IsValidNameAndLocationOfPoint(Name, Location));
- }
- [TestMethod]
- public void IsValidInfoAboutDriver()
- {
- string IdTransport = "1";
- string name = "Петр";
- string surname = "Некрасов";
- string patronymic = "Антонович";
- Assert.IsTrue(Functions.IsValidInfoAboutDriver(IdTransport, name, surname, patronymic));
- }
- [TestMethod]
- public void IsIdOnlyDigits()
- {
- string IdTransport = "123";
- Assert.IsTrue(Functions.IsIdOnlyDigits(IdTransport));
- }
- }
- }
|