コード例 #1
0
ファイル: ReplyManagerTests.cs プロジェクト: lulzzz/Denovo
        public void GetVersionMsgTest()
        {
            var ns = new MockNodeStatus();
            var cs = new MockClientSettings()
            {
                _protoVer = 123,
                _services = NodeServiceFlags.All,
                _time     = 456,
                _port     = 789,
                _ua       = "foo",
                _relay    = true,
                _netType  = NetworkType.TestNet
            };
            var bc = new MockBlockchain()
            {
                _height = 12345
            };

            var rep = new ReplyManager(ns, bc, cs)
            {
                rng = new MockNonceRng(0x0158a8e8ba5f3ed3)
            };


            Message    msg    = rep.GetVersionMsg();
            FastStream actual = new FastStream();

            msg.Serialize(actual);
            byte[] expected = Helper.HexToBytes("0b11090776657273696f6e0000000000590000000ba371327b0000001f04000000000000c8010000000000001f0400000000000000000000000000000000ffff7f00000103151f0400000000000000000000000000000000ffff7f0000010315d33e5fbae8a8580103666f6f3930000001");

            Assert.Equal(expected, actual.ToByteArray());
        }