Ejemplo n.º 1
0
        public void TestCustomTypeArray()
        {
            var array = new MatchInfo[2]
            {
                new MatchInfo()
                {
                    matchId   = 10,
                    playerIds = new List <int> {
                        1, 2, 3
                    },
                    playerNames = new List <string> {
                        "fer", "meh", "şek", "sek"
                    }
                },
                new MatchInfo()
                {
                    matchId   = 15,
                    playerIds = new List <int> {
                        1, 2, 3
                    },
                    playerNames = new List <string> {
                        "fer", "meh", "şek", "sek"
                    }
                }
            };

            _sendBridgeStream.WriteArray(array);
            var data = _sendBridgeStream.Encode();

            var receivePacket   = new BridgeStream(data);
            var returnMatchInfo = receivePacket.ReadArray <MatchInfo>();

            Assert.AreEqual(array[0].matchId, returnMatchInfo[0].matchId);
            Assert.AreEqual(array[1].matchId, returnMatchInfo[1].matchId);
        }