Example #1
0
        public void TestGetClientReturnClientWithTlfNo2222()
        {
            ClientHandler _sut   = ClientHandler.Instance;
            var           client = _sut.GetClient("2222");

            Assert.AreEqual("2222", client.TlfNo);
        }
Example #2
0
        public void TestGetClientReturnClientM()
        {
            ClientHandler _sut     = ClientHandler.Instance;
            var           client   = _sut.GetClient("2222");
            Type          actual   = client.GetType();
            Type          expected = typeof(ClientM);

            Assert.AreEqual(expected, actual);
        }
Example #3
0
        static void Main(string[] args)
        {
            var clientNr = "0";

            try
            {
                clientNr = args[0];
            }
            catch
            {
            }

            Console.Title           = $"Client {clientNr}";
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("===================================");
            Console.WriteLine($"=           C L I E N T - {clientNr}       =");
            Console.WriteLine("===================================\r\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(Dns.GetHostAddresses("endev.ddns.net")[0].ToString());

            //NetComClient client = new NetComClient(Dns.GetHostAddresses("endev.ddns.net")[0].ToString(), 2225);
            ClientHandler clientHandler = new ClientHandler("127.0.0.1", 2225);



            Console.Write("Username: "******"Password: "******"Tobias", "1");

            clientHandler.SetDebugOutput(DebugOutput.ToConsole);

            clientHandler.Start();

            Thread.Sleep(3000);

            NetComClient client = clientHandler.GetClient();

            client.Send(new InstructionLibraryEssentials.TestSample(client, null));
            while (true)
            {
                // Clients can only send directly to the server, so the receiver is set to null

                Console.Title = $"Client {clientNr}  -  Send: {clientHandler.HandlerData.LogSendCounter}     Receive: {clientHandler.HandlerData.LogReceiveCounter}";
                client.Send(new InstructionLibraryEssentials.TestSample(client, null));

                //client.Send(new InstructionLibraryEssentials.RichMessageBox(client, null, "Hallo", "Titel", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Hand));

                //client.Send(new InstructionLibraryEssentials.ToOutputStream(client, null, "Hallo"));


                Thread.Sleep(new Random().Next(500, 1000));
            }

#pragma warning disable 0162 // unreachable code
            Console.WriteLine("Done.");

            Console.ReadKey();
#pragma warning restore 0162 // unreachable code
        }