Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void ServiceFormatCreatingTests()
        {
            ServiceFormat serviceFormat = new ServiceFormat();

            Assert.NotNull(serviceFormat.CountOfCore);
            Assert.NotNull(serviceFormat.MachineName);
            Assert.NotNull(serviceFormat.Power);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        // 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
        }