コード例 #1
0
        private void FormatTest(string ImageFilename, string ExpectedHash, string FormatType)
        {
            DeleteFile(ImageFilename);

            HuDisk.Run(new string[] { ImageFilename, "--format", "--type", FormatType });
            var ImageHash = TestHelper.ComputeHashSha1(ImageFilename);

            Console.WriteLine($"Hash:{ImageHash}");
            Assert.AreEqual(ExpectedHash, ImageHash);
        }
コード例 #2
0
        public void ExtractImageTest()
        {
            var TargetFile       = "ascii.bin";
            var ImageFile        = GetDataFilePath("testimg.2d");
            var ExpectedDataFile = GetDataFilePath(TargetFile);

            var ExpectedData = File.ReadAllBytes(ExpectedDataFile);

            Assert.IsTrue(HuDisk.Run(new string[] { ImageFile, "-v", "-x", "*" }));

            var b = IsEqualFile(TargetFile, ExpectedData);

            Assert.IsTrue(b);
        }
コード例 #3
0
        private void CheckFilesize(int FileSize)
        {
            var ImageFilename = "sizetest.2d";
            var Filename      = $"{FileSize}.bin";
            var SourceFile    = GetDataFilePath(Filename);

            DeleteFile(ImageFilename);
            DeleteFile(Filename);
            Assert.IsTrue(HuDisk.Run(new string[] { ImageFilename, "-a", SourceFile }));
            Assert.IsTrue(HuDisk.Run(new string[] { ImageFilename, "-x", Filename }));
            var fi = new FileInfo(Filename);

            Assert.AreEqual(FileSize, fi.Length);
            TestEqualFile(SourceFile, Filename);

            DeleteFile(Filename);
        }
コード例 #4
0
        private void AddClusterFile(string ImageFilename, int i, bool Fail = false)
        {
            string ClusterFilename = GetClusterFilename(i);

            WriteClusterFile(i, ClusterFilename);

            bool Result = HuDisk.Run(new string[] { ImageFilename, "-a", ClusterFilename });

            if (Fail)
            {
                Assert.IsFalse(Result);
            }
            else
            {
                Assert.IsTrue(Result);
            }

            DeleteFile(ClusterFilename);
        }
コード例 #5
0
        private void AddData(string ImageFilename, int MaxCluster)
        {
            for (var i = 0; i < MaxCluster; i++)
            {
                AddClusterFile(ImageFilename, i);
            }

            AddClusterFile(ImageFilename, MaxCluster, true);

            for (var i = 0; i < MaxCluster; i++)
            {
                string ClusterFilename = GetClusterFilename(i);
                var    Data            = MakeClusterData(i);

                var Result = HuDisk.Run(new string[] { ImageFilename, "-x", ClusterFilename });
                Assert.IsTrue(Result);

                IsEqualFile(ClusterFilename, Data);

                DeleteFile(ClusterFilename);
            }
        }
コード例 #6
0
 public void NoArgumentTest()
 {
     Assert.IsFalse(HuDisk.Run(new string[] { }));
 }