123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- using MathModelingSimulator.Function;
- namespace UnitTestsSimMM
- {
- [TestClass]
- public class UnitTest
- {
- [TestMethod]
- public void GetHashPassword_Password11_Hashreturned()
- {
- string password = "11";
- string expected = "BrbeSdYMT//FOJwkU1AXSjKfOwkhepBWTx+P/IgBqRA=";
- Security obj = new Security();
- string result = obj.GetHashPassword(password);
- Assert.AreEqual(expected, result);
- }
- [TestMethod]
- public void GetMinSimplexMetod_Matrix_Expected15()
- {
- int[,] matrix = { { 0, 1, 2, 3, 4, 5, 6, 7 }, { 4, 2, -1, 1, 1, 0, 0, 1 }, { 5, -4, 2, -1, 0, 1, 0, 2 }, { 6, 3, 0, 1, 0, 0, 1, 5 }, { 0, -1, 1, 3, 0, 0, 0, 0 } };
- int expected = -15;
- SimplexMetod obj = new SimplexMetod();
- int result = obj.MainSimplexMetod(matrix, false);
- Assert.AreEqual(expected, result);
- }
- [TestMethod]
- public void GetTravelingSalesmanProblem_Matrix_Expected41()
- {
- int[,] matrix = { { 0, 20,18,12,8}, {5,0,14,7,11},{12,18,0,6,11},{11,17,11,0,12},{5,5,5,5,0}};
- int expected = 41;
- TravelingSalesmanProblem obj = new TravelingSalesmanProblem();
- int result = obj.MainTravelingSalesmanProblem(matrix);
- Assert.AreEqual(expected, result);
- }
- [TestMethod]
- public void GetMaxSimplexMetod_Matrix_Expected11()
- {
- int[,] matrix = { { 0,1,2,3,4,5,6 }, { 3,1,2,1,0,0,4 }, { 4,1,1,0,1,0,3 }, {5,2,1,0,0,1,8 }, {0,-3,-4,0,0,0,0} };
- int expected = 11;
- SimplexMetod obj = new SimplexMetod();
- int result = obj.MainSimplexMetod(matrix, true);
- Assert.AreEqual(expected, result);
- }
- [TestMethod]
- public void GetRegularTelephone_Telephone_ExpectedTrue()
- {
- string Telephone = "+7 985 678 23 43";
- bool expected = true;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularTelephone(Telephone);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularTelephone_Telephone_ExpectedFalse()
- {
- string Telephone = "999 999 99 99";
- bool expected = false;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularTelephone(Telephone);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularPassword_Password123_ExpectedFalse()
- {
- string Password = "123";
- bool expected = false;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularPassword(Password);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularPassword_PasswordAbcd1234_ExpectedTrue()
- {
- string Password = "Abcd1234";
- bool expected = true;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularPassword(Password);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularSurname_Surname_ExpectedTrue()
- {
- string Surname = "Àáðàìîâà";
- bool expected = true;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularSurname(Surname);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularSurname_Surname_ExpectedFalse()
- {
- string Surname = "Abramova";
- bool expected = false;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularSurname(Surname);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularName_Name_ExpectedTrue()
- {
- string Name = "Åâãåíèÿ";
- bool expected = true;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularName(Name);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularName_Surname_ExpectedFalse()
- {
- string Name = "Evgenia";
- bool expected = false;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularName(Name);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularEmail_Email_ExpectedTrue()
- {
- string Email = "abcd@mail.ru";
- bool expected = true;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularEmail(Email);
- Assert.AreEqual(expected, result.isTrueField);
- }
- [TestMethod]
- public void GetRegularEmail_Email_ExpectedFalse()
- {
- string Email = "1@mail";
- bool expected = false;
- Regular obj = new Regular();
- (bool isTrueField, string message) result = obj.GetRegularEmail(Email);
- Assert.AreEqual(expected, result.isTrueField);
- }
- }
- }
|