Exemplo n.º 1
0
        public void TestMethod_01()
        {
            var header = new Header
            {
                version = 1,
                type    = "type1"
            };
            var records = new TradeRecord[64];

            for (var i = 0; i < records.Length; i++)
            {
                records[i] = new TradeRecord
                {
                    account = i + 1,
                    id      = i,
                    volume  = i * 10d,
                    comment = "comment" + i
                };
            }

            var bytes = StructureParser.Serialize(header, records);

            Assert.AreNotEqual(bytes.Length, 0, "Bad encoded");

            File.WriteAllBytes(BIN_FILE, bytes);
        }
Exemplo n.º 2
0
        private static void Generate(string file)
        {
            var header = new Header
            {
                version = 1,
                type    = "type1"
            };
            var records = new TradeRecord[64];

            for (var i = 0; i < records.Length; i++)
            {
                records[i] = new TradeRecord
                {
                    account = i + 1,
                    id      = i,
                    volume  = i * 10d,
                    comment = "comment" + i
                };
            }

            var bytes = StructureParser.Serialize(header, records);

            File.WriteAllBytes(file, bytes);

            Console.WriteLine("Test binary file is generated!");
            Console.WriteLine("Please copy to server in temparery folder and put file name with '-u' command");
        }
Exemplo n.º 3
0
        public void TestMethod_02()
        {
            var bytes         = File.ReadAllBytes(BIN_FILE);
            var myDataStruct1 = StructureParser.Deserialize(bytes);
            var bytes1        = StructureParser.Serialize(myDataStruct1.Item1, myDataStruct1.Item2);

            Assert.IsTrue(bytes.SequenceEqual(bytes1), "Bad decoded");
        }