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); }
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); }
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); }
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); }
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); } }
public void NoArgumentTest() { Assert.IsFalse(HuDisk.Run(new string[] { })); }