public AnalyzedPageInteractorImpl(IServiceProvider services) : base(services) { decompilerSvc = services.RequireService<IDecompilerService>(); codeViewerSvc = services.RequireService<ICodeViewerService>(); memViewerSvc = services.RequireService<ILowLevelViewService>(); disasmViewerSvc = services.RequireService<IDisassemblyViewService>(); projectSvc = services.RequireService<IProjectBrowserService>(); this.canAdvance = true; }
public AnalyzedPageInteractorImpl(IServiceProvider services) : base(services) { decompilerSvc = services.RequireService <IDecompilerService>(); codeViewerSvc = services.RequireService <ICodeViewerService>(); memViewerSvc = services.RequireService <ILowLevelViewService>(); disasmViewerSvc = services.RequireService <IDisassemblyViewService>(); projectSvc = services.RequireService <IProjectBrowserService>(); this.canAdvance = true; }
public void Setup() { mr = new MockRepository(); form = mr.StrictMock <IMainForm>(); sc = new ServiceContainer(); uiSvc = AddService <IDecompilerShellUiService>(); sc.AddService(typeof(IDecompilerUIService), uiSvc); codeViewSvc = AddService <ICodeViewerService>(); memViewSvc = AddService <ILowLevelViewService>(); disasmViewSvc = AddService <IDisassemblyViewService>(); pbSvc = AddService <IProjectBrowserService>(); form.Stub(f => f.Show()); var platform = mr.Stub <IPlatform>(); var loadAddress = Address.Ptr32(0x100000); var bytes = new byte[4711]; var arch = new X86ArchitectureFlat32(); var mem = new MemoryArea(loadAddress, bytes); Program prog = new Program { SegmentMap = new SegmentMap( mem.BaseAddress, new ImageSegment(".text", mem, AccessMode.ReadExecute)), Architecture = arch, Platform = platform, }; ILoader ldr = mr.StrictMock <ILoader>(); ldr.Stub(l => l.LoadExecutable(null, null, null)).IgnoreArguments().Return(prog); ldr.Stub(l => l.LoadImageBytes(null, 0)).IgnoreArguments().Return(bytes); ldr.Replay(); sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener()); sc.AddService <DecompilerHost>(new FakeDecompilerHost()); this.decSvc = new DecompilerService(); decSvc.Decompiler = new DecompilerDriver(ldr, sc); decSvc.Decompiler.Load("test.exe"); program = decSvc.Decompiler.Project.Programs.First(); decSvc.Decompiler.ScanPrograms(); sc.AddService(typeof(IDecompilerService), decSvc); sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService()); }
public void Setup() { mr = new MockRepository(); form = mr.StrictMock <IMainForm>(); sc = new ServiceContainer(); uiSvc = AddService <IDecompilerShellUiService>(); sc.AddService(typeof(IDecompilerUIService), uiSvc); codeViewSvc = AddService <ICodeViewerService>(); memViewSvc = AddService <ILowLevelViewService>(); disasmViewSvc = AddService <IDisassemblyViewService>(); pbSvc = AddService <IProjectBrowserService>(); form.Stub(f => f.Show()); var loadAddress = Address.Ptr32(0x100000); var bytes = new byte[4711]; Program prog = new Program(); prog.Image = new LoadedImage(loadAddress, bytes); prog.ImageMap = prog.Image.CreateImageMap(); prog.Architecture = new IntelArchitecture(ProcessorMode.Protected32); ILoader ldr = mr.StrictMock <ILoader>(); ldr.Stub(l => l.LoadExecutable(null, null, null)).IgnoreArguments().Return(prog); ldr.Stub(l => l.LoadImageBytes(null, 0)).IgnoreArguments().Return(bytes); ldr.Replay(); sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener()); this.decSvc = new DecompilerService(); decSvc.Decompiler = new DecompilerDriver(ldr, new FakeDecompilerHost(), sc); decSvc.Decompiler.Load("test.exe"); program = decSvc.Decompiler.Project.Programs.First(); decSvc.Decompiler.ScanPrograms(); sc.AddService(typeof(IDecompilerService), decSvc); sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService()); }
private void Given_MainFormInteractor() { program = CreateFakeProgram(); svcFactory = mr.StrictMock <IServiceFactory>(); archSvc = mr.StrictMock <IArchiveBrowserService>(); dlgFactory = mr.StrictMock <IDialogFactory>(); memSvc = mr.StrictMock <ILowLevelViewService>(); disasmSvc = mr.StrictMock <IDisassemblyViewService>(); typeLibSvc = mr.StrictMock <ITypeLibraryLoaderService>(); brSvc = mr.Stub <IProjectBrowserService>(); uiPrefs = mr.StrictMock <IUiPreferencesService>(); fsSvc = mr.StrictMock <IFileSystemService>(); tcHostSvc = mr.StrictMock <ITabControlHostService>(); dcSvc = mr.StrictMock <IDecompilerService>(); srSvc = MockRepository.GenerateMock <ISearchResultService, IWindowPane>(); diagnosticSvc = MockRepository.GenerateMock <IDiagnosticsService, IWindowPane>(); resEditSvc = mr.StrictMock <IResourceEditorService>(); cgvSvc = mr.StrictMock <ICallGraphViewService>(); loader = mr.StrictMock <ILoader>(); sbSvc = mr.Stub <IStatusBarService>(); vimpSvc = mr.StrictMock <IViewImportsService>(); cvSvc = mr.StrictMock <ICodeViewerService>(); imgSegSvc = mr.StrictMock <ImageSegmentService>(); symLoadSvc = mr.StrictMock <ISymbolLoadingService>(); svcFactory.Stub(s => s.CreateArchiveBrowserService()).Return(archSvc); svcFactory.Stub(s => s.CreateCodeViewerService()).Return(cvSvc); svcFactory.Stub(s => s.CreateDecompilerConfiguration()).Return(new FakeDecompilerConfiguration()); svcFactory.Stub(s => s.CreateDiagnosticsService()).Return(diagnosticSvc); svcFactory.Stub(s => s.CreateDecompilerService()).Return(dcSvc); svcFactory.Stub(s => s.CreateDisassemblyViewService()).Return(disasmSvc); svcFactory.Stub(s => s.CreateMemoryViewService()).Return(memSvc); svcFactory.Stub(s => s.CreateDecompilerEventListener()).Return(new FakeDecompilerEventListener()); svcFactory.Stub(s => s.CreateImageSegmentService()).Return(imgSegSvc); svcFactory.Stub(s => s.CreateInitialPageInteractor()).Return(new FakeInitialPageInteractor()); svcFactory.Stub(s => s.CreateScannedPageInteractor()).Return(new FakeScannedPageInteractor()); svcFactory.Stub(s => s.CreateTypeLibraryLoaderService()).Return(typeLibSvc); svcFactory.Stub(s => s.CreateProjectBrowserService()).Return(brSvc); svcFactory.Stub(s => s.CreateUiPreferencesService()).Return(uiPrefs); svcFactory.Stub(s => s.CreateFileSystemService()).Return(fsSvc); svcFactory.Stub(s => s.CreateStatusBarService()).Return(sbSvc); svcFactory.Stub(s => s.CreateTabControlHost()).Return(tcHostSvc); svcFactory.Stub(s => s.CreateLoader()).Return(loader); svcFactory.Stub(s => s.CreateSearchResultService()).Return(srSvc); svcFactory.Stub(s => s.CreateResourceEditorService()).Return(resEditSvc); svcFactory.Stub(s => s.CreateCallGraphViewService()).Return(cgvSvc); svcFactory.Stub(s => s.CreateViewImportService()).Return(vimpSvc); svcFactory.Stub(s => s.CreateSymbolLoadingService()).Return(symLoadSvc); services.AddService(typeof(IDialogFactory), dlgFactory); services.AddService(typeof(IServiceFactory), svcFactory); brSvc.Stub(b => b.Clear()); form = mr.StrictMock <IMainForm>(); form.Stub(f => f.Dispose()); form.Stub(f => f.UpdateToolbarState()); form.Closed += null; LastCall.IgnoreArguments(); tcHostSvc.Stub(t => t.QueryStatus( Arg <CommandID> .Is.Anything, Arg <CommandStatus> .Is.Anything, Arg <CommandText> .Is.Anything)).Return(false); tcHostSvc.Stub(t => t.Execute(Arg <CommandID> .Is.Anything)).Return(false); uiSvc.Stub(u => u.DocumentWindows).Return(new List <IWindowFrame>()); brSvc.Stub(u => u.ContainsFocus).Return(false); tcHostSvc.Stub(u => u.ContainsFocus).Return(false); // We currently don't care about testing the appearance of the Main window text. // Should this be required, you will need to remove the line below and add an // appropriate stub/expectation in all the tests below. Good luck with that. form.Stub(f => f.TitleText = "").IgnoreArguments(); }