public void Read_Data_Should_Match_Source_File()
        {
            string targetPath = FileUtil.CreateTempFilePath(ParentDirectory.FullName, "copy", "bin");

            //get stream and write to file
            using (Stream stream = DownloadHandler.ReadFile(SourceFileInfo.FullName))
            {
                stream.WriteTo(targetPath);
            }

            //calculate hashes of source and target and compare
            string sourceHash = SourceFile.CalculateMd5Hash();
            string targetHash = new FileInfo(targetPath).CalculateMd5Hash();

            Assert.AreEqual(sourceHash, targetHash);
        }
コード例 #2
0
        public void Read_Data_Should_Match_Source_File()
        {
            string targetPath = FileUtil.CreateTempFilePath(RootDir.FullName, "copy", "bin");

            //get stream and write to file
            using (Stream stream = DownloadService.ReadResourceStreamed(Token.TransferId))
            {
                stream.WriteTo(targetPath);
            }

            //calculate hashes of source and target and compare
            string sourceHash = SourceFile.CalculateMd5Hash();
            string targetHash = new FileInfo(targetPath).CalculateMd5Hash();

            Assert.AreEqual(sourceHash, targetHash);
        }