コード例 #1
0
        public void BsNormalTest()
        {
            var bs1  = new VgcApis.Libs.Streams.BitStream();
            var uuid = Guid.NewGuid();

            bs1.Write(true);
            bs1.Write(12345);
            bs1.Write(uuid);
            bs1.WriteAddress("abc.com");
            bs1.WriteAddress("::1");
            bs1.WriteAddress("1.2.3.4");
            bs1.Write("123");
            bs1.Write("1中23文");
            var b1 = bs1.ToBytes("1a");

            bs1.Dispose();
            var bs2 = new VgcApis.Libs.Streams.BitStream(b1);
            var b2  = bs2.ToBytes("1a");

            bs2.Dispose();

            for (int i = 0; i < b1.Length; i++)
            {
                Assert.AreEqual(b2[i], b1[i]);
            }
        }