public void WorkingTest() { router.ClearQueues(); router.MaxTimeForAnswer = new TimeSpan(0, 0, 0, 10); ServiceFormat sf = new ServiceFormat(); router.SendServiceMessage(sf); TaskFormat t = new TaskFormat("zveq", 100); t.Convolutions.Add(Cryptography.Encryption("zver")); t.Convolutions.Add(Cryptography.Encryption("q")); t.Convolutions.Add(Cryptography.Encryption("qwerty")); t.Convolutions.Add(Cryptography.Encryption("zver31031993")); t.StartWord = "q"; router.SendTask(t); TaskFormat task = router.GetTask(); SearchEngineSolutions fabrica = new SearchEngineSolutions(task); AnswerFormat answer = fabrica.FindSolution(); router.SendAnswer(answer); }
public void ServiceFormatCreatingTests() { ServiceFormat serviceFormat = new ServiceFormat(); Assert.NotNull(serviceFormat.CountOfCore); Assert.NotNull(serviceFormat.MachineName); Assert.NotNull(serviceFormat.Power); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="ClientManager"/>. /// </summary> /// <param name="serverName"> /// Имя сервера для подключения. /// </param> public ClientManager(string serverName) : this() { if (string.IsNullOrEmpty(serverName)) { serverName = new ServiceFormat().MachineName; Console.WriteLine("Выбрано имя сервера по умолчанию: " + serverName); } this.ConnectToServer(serverName); }
public void GettingServiceTest() { ServiceFormat service = new ServiceFormat(); router.ClearQueues(); router.SendServiceMessage(service); ServiceFormat gettingService = router.GetServiceMessage(); Assert.AreEqual(gettingService.CountOfCore, service.CountOfCore); Assert.AreEqual(gettingService.MachineName, service.MachineName); Assert.AreEqual(gettingService.Power, service.Power); }
// ReSharper restore FunctionNeverReturns /// <summary> /// Пруслушивание подключенных клиентов. /// </summary> private void ClientListner() { while (true) { // блок информации о клиентах ServiceFormat sf = this.taskManagerRouter.GetServiceMessage(); Console.WriteLine("Клиент '" + sf.MachineName + "' был подключен."); Console.WriteLine( " - Количество ядер процессора: " + sf.CountOfCore.ToString(CultureInfo.InvariantCulture)); Console.WriteLine( " - Количество операций в секунду: " + sf.Power.ToString(CultureInfo.InvariantCulture)); Console.WriteLine(); } // ReSharper disable FunctionNeverReturns }