コード例 #1
0
        public void OldFormatProviderFilesCheck()
        {
            var files = System.IO.Directory.GetFiles("TestData\\OldTestFiles");

            var oldSerializerFormatProvider = new OldSerializeFormatProvider(DataBase);

            Assert.IsTrue(files.Any(), "there are no test files");

            foreach (var file in files)
            {
                var fileInfo = new System.IO.FileInfo(file);

                var bytes = new Byte[fileInfo.Length];

                using (var stream = fileInfo.OpenRead())
                { stream.Read(bytes, 0, bytes.Length); }

                DeserializeResult deserializeResult;

                var result = oldSerializerFormatProvider.TryDecodeData(GetRsa, bytes, out deserializeResult);

                Assert.IsTrue(result);
                Assert.IsNotNull(deserializeResult);
            }
        }
コード例 #2
0
        public void TryReadNewTXTFile()
        {
            var oldSerializerFormatProvider = new OldSerializeFormatProvider(DataBase);

            var fileInfo = new System.IO.FileInfo("TestData\\TXTTestFiles\\testData.txt");

            var bytes = new Byte[fileInfo.Length];

            using (var stream = fileInfo.OpenRead())
            { stream.Read(bytes, 0, bytes.Length); }

            DeserializeResult deserializeResult;

            var result = oldSerializerFormatProvider.TryDecodeData(GetRsa, bytes, out deserializeResult);

            Assert.IsFalse(result);
            Assert.IsNull(deserializeResult);
        }