private static void RunTest([NotNull] string testFile) { ICpu cpu; using (var file = File.OpenRead("CpuBinaries/" + testFile)) cpu = new Cpu8086(file, 1024 * 1024); cpu.WriteBytes(0, new byte[0x100]); if (cpu.ProcessInstructions(1000)) { throw new InvalidOperationException("Test case did not complete in the required amount of time."); } using (var file = File.OpenRead($"CpuBinaries/{testFile}Result")) { var goodData = new byte[file.Length]; if (file.Read(goodData, 0, goodData.Length) != goodData.Length) { throw new InvalidDataException(); } var testData = cpu.ReadBytes(0, (uint)goodData.Length); var result = CompareArrays(goodData, testData); if (result.Count > 0) { var comparison = result.Select(i => new Tuple <int, byte, byte>(i, goodData[i], testData[i])).ToList(); throw new InvalidOperationException("Test case did not produce valid output."); } } }