123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Курсовой_проект_3._1
- {
- public static class Test
- {
- // for test only
- public static bool PlayerInfoOutput()
- {
- MyTeamContext _context = new MyTeamContext();
- return true;
- }
- // for test only
- public static bool CreateTeamApp(int teamId, string title, string text)
- {
- int teamIdWithApp = 1;
- if (string.IsNullOrWhiteSpace(title) || string.IsNullOrWhiteSpace(text))
- {
- return false;
- }
- if (teamId == teamIdWithApp)
- {
- return false;
- }
- if (title.Length > 20)
- {
- return false;
- }
- if (text.Length > 255)
- {
- return false;
- }
- return true;
- }
- // for test only
- public static bool CreatePlayerApp(int userId, string title, string text)
- {
- int userIdWithApp = 1;
- if (string.IsNullOrWhiteSpace(title) || string.IsNullOrWhiteSpace(text))
- {
- return false;
- }
-
- if (userId == userIdWithApp)
- {
- return false;
- }
- if (title.Length > 20)
- {
- return false;
- }
- if (text.Length > 255)
- {
- return false;
- }
- return true;
- }
- // for test only
- public static bool ChangeSettingsTest(int userId, string email, string phoneNumber, string about)
- {
- phoneNumber = phoneNumber.TrimStart('+');
- string existEmail, existPhoneNumber;
- existEmail = "nikich4523@mail.ru";
- existPhoneNumber = "79641166987";
- string nowUserEmail, nowUserPhoneNumber;
- nowUserEmail = "alen.20.plo@mail.ru";
- nowUserPhoneNumber = "79132818850";
- // проверка на корректность введенной почты
- if (!string.IsNullOrWhiteSpace(email))
- {
- if (email != nowUserEmail)
- {
- if (email != existEmail)
- {
- if (Func.IsValidEmail(email))
- {
- //
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- }
- else
- {
- return false;
- }
- // проверка на корректность введенного номера телефона
- if (!string.IsNullOrWhiteSpace(phoneNumber))
- {
- if (phoneNumber != nowUserPhoneNumber)
- {
- if (phoneNumber != existPhoneNumber)
- {
- if (Func.IsValidPhoneNumber(phoneNumber))
- {
- //
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- }
- else
- {
- return false;
- }
- return true;
- }
- // for test only
- public static bool AuthorizationTest(string login, string password)
- {
- if (Func.IsValidLogAndPass(login, password))
- {
- if (login == "nikich4523" && password == "123qaz")
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- // for test only
- public static bool RegistrationTest(string login, string pass, string fname, string lname, string mname, string nickname, string email, string phoneNumber, string birthday)
- {
- phoneNumber = phoneNumber.TrimStart('+');
- string existLogin, existEmail, existPhoneNumber, existNickname;
- existLogin = "nikich4523";
- existEmail = "nikich4523@mail.ru";
- existNickname = "Arxont";
- existPhoneNumber = "+79132818850";
- // проверка на заполненость всех полей
- if (Func.IsNullOrWhiteSpace(new string[] { login, pass, nickname, fname, lname, mname, birthday }))
- {
- return false;
- }
- // проверка на уникальность полей
- if (login == existLogin || email == existEmail || existNickname == nickname || existPhoneNumber == phoneNumber)
- {
- return false;
- }
- // проверка на корректность
- if (!Func.IsValidPhoneNumber(phoneNumber))
- {
- return false;
- }
- if (!Func.IsValidEmail(email))
- {
- return false;
- }
- return true;
- }
- }
- }
|