コード例 #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();
        }
コード例 #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"));
        }
コード例 #3
0
ファイル: ISCommV3Test1.cs プロジェクト: Algorithman/ISCommV3
        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);
        }