public void TestDOSDevice() { //测试是否能够正常识别Dos镜像; _stream = File.OpenRead(DOSImgPath); Assert.IsTrue(_streamParser.CheckIsValidStream(_stream)); var file = _streamParser.ParseStream(_stream, string.Empty, null); //检查"签名"; Assert.IsTrue(file.TypeGuid == SingularityForensic.BaseDevice.Constants.DeviceType_DOS); if (file is IDevice device) { Assert.AreEqual(device.PartitionEntries.Count(), DOSPartEntryCount); Assert.AreEqual(device.Children.Count, DOSPartCount); foreach (var entry in device.PartitionEntries) { Trace.WriteLine($"{entry.PartStartLBA} - {entry.PartSize}"); } device.Dispose(); } else { Assert.Fail($"The {nameof(file)} should be a {nameof(IDevice)}."); } _stream.Dispose(); }
public void CheckIsValidStreamTest() { Assert.IsTrue(_streamParsingProvider.CheckIsValidStream(_fatStream)); using (var unKnownStream = File.OpenRead(UnknownImgPath)) { Assert.IsFalse(_streamParsingProvider.CheckIsValidStream(unKnownStream)); } }