Exemplo n.º 1
0
        public void TestMethod1()
        {
            var server = new ISCommServer();
            var client = new ISCommClient();

            server.Start(4545);

            BaseMessage dm = new EchoMessage();

            client.Connect("localhost", 4545);

            var em = new EchoMessage();

            em.EchoText = "Hallo";

            this.mrep.Reset();
            client.ObjectReceived += this.ClientObjectReceived;
            client.Send(em);

            this.mrep.WaitOne();

            Assert.IsNotNull(this.reply);
            Assert.IsAssignableFrom <AnswerMessage>(this.reply);
            Assert.AreEqual(((AnswerMessage)this.reply).Echo, em.EchoText);
            server.Stop();
        }
Exemplo n.º 2
0
        public void OutSideMessageClassTest()
        {
            var server = new ISCommServer();
            var client = new ISCommClient();

            server.Start(4343);
            this.mrep.Reset();
            client.ObjectReceived += this.client_ObjectReceived;
            client.Connect("localhost", server.Port);

            client.Send(new DerivedTest());

            this.mrep.WaitOne();
            Assert.IsTrue((this.reply is AnswerMessage) && (((AnswerMessage)this.reply).Echo == "Derived"));
        }
Exemplo n.º 3
0
        /// <summary>
        ///     The one thread execution.
        /// </summary>
        private void OneThreadExecution()
        {
            var client = new ISCommClient();

            client.ObjectReceived += this.client_ObjectReceived;
            this.countdown.Signal();
            this.mre.WaitOne();
            client.Connect("localhost", this.server.Port);

            try
            {
                client.Send(new WaitMessage());
            }
            catch (Exception exception)
            {
            }

            this.countdown.Signal();
        }
Exemplo n.º 4
0
        public void Test1()
        {
            var server = new ISCommServer();
            var client = new ISCommClient(-1, -1, false);

            server.Start(4545);

            client.Connect("localhost", 4545);
            client.ObjectReceived += this.client_ObjectReceived;

            var em = new EchoMessage();

            em.EchoText = "Hallo";

            mrep.Reset();

            client.Send(em);
            mrep.WaitOne();

            Assert.IsNotNull(this.reply);
            Assert.IsInstanceOf <AnswerMessage>(this.reply);
        }