public void CCConstructorAndRegister()
        {
            //Arrange
            string ip_address = "127.0.0.1";
            int port = 22;

            //string problem_data_filepath = "CCTest.xml";
            string problem_type = "dvrp";
            //Act
            ComputationalClient cc = new ComputationalClient(ip_address, port, null,problem_type);
            //Assert
            Assert.IsNotNull(cc);

            //Assert.IsTrue(cc.registerProblem(problem_data_filepath));
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            string ip_address;
            string port;
            ulong timeout;
            ulong? n_timeout;
            string problem_type;
            bool is_registered = false;
            ulong? problem_id = null;

            Console.WriteLine("Do you want to check status of existing problem? (y/n)\n");
            string dec = Console.ReadLine();
            if (dec == "y")
            {
                Console.Write("problem id:  ");
                problem_id = ulong.Parse(Console.ReadLine());
            }

            Console.Write("IP Address:  ");
            ip_address = Console.ReadLine();
            Console.Write("Port number: ");
            port = Console.ReadLine();
            Console.Write("problem_type: ");
            problem_type = Console.ReadLine();
            Console.Write("(optionally) timeout: ");
            UInt64.TryParse(Console.ReadLine(),out timeout);
            if (timeout == 0) n_timeout = null;
            else n_timeout = timeout;
            ComputationalClient new_client;

            new_client = new ComputationalClient(problem_id,ip_address, int.Parse(port), n_timeout, problem_type);

            ConsoleKeyInfo info;
            if (dec == "y") is_registered = true;
            else
            {
                Console.Write(usage_info);

                 info = Console.ReadKey();
                if (info.Key == ConsoleKey.Enter)
                {
                    string chosen_file = null;

                    if ((chosen_file = chooseFile()) != null)
                    {
                        is_registered = new_client.registerProblem(chosen_file);
                    }

                }
            }

            if (is_registered)
            {
                new_client.Work();
                Console.Write(usage_info_after_register);
                do
                {

                    info = Console.ReadKey();
                    if (info.Key == ConsoleKey.A)
                    {
                        //pobranie statusu problemu na żądanie
                        new_client.getProblemStatus();
                    }

                }
                while (info.Key!=ConsoleKey.Escape);

            }
            else
                Console.WriteLine("Client is not registered");

            return;
        }