public void SudLoadMetadata() { var sProject = new Project_v2 { Inputs = { new MetadataFile_v2 { Filename = "c:\\tmp\\foo.def" } } }; var loader = mr.Stub<ILoader>(); var typelib = new TypeLibrary(); loader.Stub(l => l.LoadMetadata("")).IgnoreArguments().Return(typelib); mr.ReplayAll(); var ploader = new ProjectLoader(loader); var project = ploader.LoadProject(sProject); Assert.AreEqual(1, project.MetadataFiles.Count); Assert.AreEqual("c:\\tmp\\foo.def", project.MetadataFiles[0].Filename); }
public void SudLoadProgramOptions() { var sProject = new Project_v2 { Inputs = { new DecompilerInput_v2 { Options = new ProgramOptions_v2 { HeuristicScanning = true, } } } }; var loader = mr.Stub<ILoader>(); loader.Stub(l => l.LoadImageBytes(null, 0)) .IgnoreArguments() .Return(new byte[10]); loader.Stub(l => l.LoadExecutable(null, null, null)) .IgnoreArguments() .Return(new Program()); mr.ReplayAll(); var ploader = new ProjectLoader(loader); var project = ploader.LoadProject(sProject); Assert.IsTrue(project.Programs[0].Options.HeuristicScanning); }
public void Sud_LoadProject_Inputs_v2() { Given_Loader(); Given_Architecture(); Expect_Arch_ParseAddress("1000:0400", Address.SegPtr(0x1000, 0x0400)); Given_ExecutableProgram("foo.exe", Address.SegPtr(0x1000, 0x0000)); Given_BinaryFile("foo.bin", Address.SegPtr(0x1000, 0x0000)); var sProject = new Project_v2 { Inputs = { new DecompilerInput_v2 { Filename = "foo.exe", Address = "1000:0000", Comment = "main file", UserGlobalData = new List<GlobalDataItem_v2> { new GlobalDataItem_v2 { Address = "1000:0400", DataType = new StringType_v2 { Termination=StringType_v2.ZeroTermination, CharType= new PrimitiveType_v1 { ByteSize = 1, Domain=Domain.Character} } } } }, new DecompilerInput_v2 { Filename = "foo.bin", Address = "1000:D000", Comment = "overlay", Processor = "x86-real-16", } } }; mr.ReplayAll(); var ps = new ProjectLoader(loader); var project = ps.LoadProject(sProject); Assert.AreEqual(2, project.Programs.Count); var input0 = project.Programs[0]; Assert.AreEqual(1, input0.UserGlobalData.Count); Assert.AreEqual("1000:0400", input0.UserGlobalData.Values[0].Address); var str_t = (StringType_v2)input0.UserGlobalData.Values[0].DataType; Assert.AreEqual("prim(Character,1)", str_t.CharType.ToString()); mr.VerifyAll(); }