コード例 #1
0
        public void Setup()
        {
            this.mr       = new MockRepository();
            this.fsSvc    = mr.StrictMock <IFileSystemService>();
            this.tllSvc   = mr.Stub <ITypeLibraryLoaderService>();
            this.services = mr.StrictMock <IServiceProvider>();
            var cfgSvc = mr.Stub <IConfigurationService>();
            var env    = mr.Stub <OperatingEnvironment>();

            this.arch = new M68kArchitecture("m68k");
            this.rtls = new List <RtlInstruction>();
            this.m    = new RtlEmitter(rtls);
            cfgSvc.Stub(c => c.GetEnvironment("amigaOS")).Return(env);
            env.Stub(e => e.TypeLibraries).Return(new List <ITypeLibraryElement>());
            env.Stub(e => e.CharacteristicsLibraries).Return(new List <ITypeLibraryElement>());
            env.Stub(e => e.Options).Return(new Dictionary <string, object>
            {
                { "versionDependentLibraries", new Dictionary <string, object>
                  {
                      { "33", new List <object> {
                            "exec_v33", "dos_v33"
                        } },
                      { "34", new List <object> {
                            "exec_v34", "dos_v34"
                        } },
                  } }
            });
            this.services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(cfgSvc);
            this.services.Stub(s => s.GetService(typeof(IFileSystemService))).Return(fsSvc);
            this.services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tllSvc);
            this.binder = new Frame(arch.FramePointerType);
        }
コード例 #2
0
ファイル: AmigaOSPlatformTests.cs プロジェクト: relaxar/reko
 public void Setup()
 {
     this.mr = new MockRepository();
     this.fsSvc = mr.StrictMock<IFileSystemService>();
     this.tllSvc = mr.Stub<ITypeLibraryLoaderService>();
     this.services = mr.StrictMock<IServiceProvider>();
     var cfgSvc = mr.Stub<IConfigurationService>();
     var env = mr.Stub<OperatingEnvironment>();
     this.arch = new M68kArchitecture();
     this.rtls = new List<RtlInstruction>();
     this.m = new RtlEmitter(rtls);
     cfgSvc.Stub(c => c.GetEnvironment("amigaOS")).Return(env);
     env.Stub(e => e.TypeLibraries).Return(new List<ITypeLibraryElement>());
     env.Stub(e => e.CharacteristicsLibraries).Return(new List<ITypeLibraryElement>());
     env.Stub(e => e.Options).Return(new Dictionary<string, object>
     {
         { "versionDependentLibraries", new Dictionary<string,object>
             {
                 { "33", new List<object> { "exec_v33", "dos_v33" } },
                 { "34", new List<object> { "exec_v34", "dos_v34" } },
             }
         }
     });
     this.services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(cfgSvc);
     this.services.Stub(s => s.GetService(typeof(IFileSystemService))).Return(fsSvc);
     this.services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tllSvc);
     this.frame = new Frame(arch.FramePointerType);
 }
コード例 #3
0
 public void Setup()
 {
     this.mr     = new MockRepository();
     this.sc     = new ServiceContainer();
     this.arch   = mr.Stub <IProcessorArchitecture>();
     this.tlSvc  = mr.Stub <ITypeLibraryLoaderService>();
     this.cfgSvc = mr.Stub <IConfigurationService>();
     sc.AddService <IConfigurationService>(cfgSvc);
     sc.AddService <ITypeLibraryLoaderService>(tlSvc);
 }
コード例 #4
0
ファイル: SysVPlatformTests.cs プロジェクト: relaxar/reko
        public void Setup()
        {
            this.mr = new MockRepository();
            this.sc = new ServiceContainer();
            this.arch = mr.Stub<IProcessorArchitecture>();
            this.tlSvc = mr.Stub<ITypeLibraryLoaderService>();
            this.cfgSvc = mr.Stub<IConfigurationService>();
            sc.AddService<IConfigurationService>(cfgSvc);
            sc.AddService<ITypeLibraryLoaderService>(tlSvc);

        }
コード例 #5
0
 public override void Setup()
 {
     base.Setup();
     this.arch     = mr.Stub <IProcessorArchitecture>();
     this.arch32be = mr.Stub <IProcessorArchitecture>();
     this.tlSvc    = mr.Stub <ITypeLibraryLoaderService>();
     sc.AddService <ITypeLibraryLoaderService>(tlSvc);
     cfgSvc.Stub(d => d.GetArchitecture("x86-protected-32")).Return(arch);
     cfgSvc.Stub(d => d.GetEnvironment("elf-neutral")).Return(new OperatingEnvironmentElement
     {
         TypeName = typeof(SysVPlatform).AssemblyQualifiedName
     });
 }
コード例 #6
0
ファイル: AmigaOSPlatformTests.cs プロジェクト: nemerle/reko
 public void Setup()
 {
     this.mr = new MockRepository();
     this.fsSvc = mr.StrictMock<IFileSystemService>();
     this.tllSvc = mr.Stub<ITypeLibraryLoaderService>();
     this.services = mr.StrictMock<IServiceProvider>();
     this.arch = new M68kArchitecture();
     this.rtls = new List<RtlInstruction>();
     this.m = new RtlEmitter(rtls);
     this.services.Stub(s => s.GetService(typeof(IFileSystemService))).Return(fsSvc);
     this.services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tllSvc);
     this.frame = new Frame(arch.FramePointerType);
 }
コード例 #7
0
ファイル: ElfImageLoaderTests.cs プロジェクト: mmyydd/reko
 public void Setup()
 {
     this.mr       = new MockRepository();
     this.arch     = mr.Stub <IProcessorArchitecture>();
     this.services = mr.Stub <IServiceProvider>();
     this.dcSvc    = mr.Stub <IConfigurationService>();
     this.tlSvc    = mr.Stub <ITypeLibraryLoaderService>();
     services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(dcSvc);
     services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tlSvc);
     dcSvc.Stub(d => d.GetArchitecture("x86-protected-32")).Return(arch);
     dcSvc.Stub(d => d.GetEnvironment("elf-neutral")).Return(new OperatingEnvironmentElement
     {
         TypeName = typeof(SysVPlatform).AssemblyQualifiedName
     });
 }
コード例 #8
0
 public void Setup()
 {
     this.mr = new MockRepository();
     this.fsSvc = mr.StrictMock<IFileSystemService>();
     this.tllSvc = mr.Stub<ITypeLibraryLoaderService>();
     this.services = mr.StrictMock<IServiceProvider>();
     var cfgSvc = mr.Stub<IConfigurationService>();
     var env = mr.Stub<OperatingEnvironment>();
     this.arch = new M68kArchitecture();
     this.rtls = new List<RtlInstruction>();
     this.m = new RtlEmitter(rtls);
     cfgSvc.Stub(c => c.GetEnvironment("amigaOS")).Return(env);
     env.Stub(e => e.TypeLibraries).Return(new TypeLibraryElementCollection());
     env.CharacteristicsLibraries = new TypeLibraryElementCollection();
     this.services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(cfgSvc);
     this.services.Stub(s => s.GetService(typeof(IFileSystemService))).Return(fsSvc);
     this.services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tllSvc);
     this.frame = new Frame(arch.FramePointerType);
 }
コード例 #9
0
ファイル: AmigaOSPlatformTests.cs プロジェクト: Godzil/reko
        public void Setup()
        {
            this.mr       = new MockRepository();
            this.fsSvc    = mr.StrictMock <IFileSystemService>();
            this.tllSvc   = mr.Stub <ITypeLibraryLoaderService>();
            this.services = mr.StrictMock <IServiceProvider>();
            var cfgSvc = mr.Stub <IConfigurationService>();
            var env    = mr.Stub <OperatingEnvironment>();

            this.arch = new M68kArchitecture();
            this.rtls = new List <RtlInstruction>();
            this.m    = new RtlEmitter(rtls);
            cfgSvc.Stub(c => c.GetEnvironment("amigaOS")).Return(env);
            env.Stub(e => e.TypeLibraries).Return(new List <ITypeLibraryElement>());
            env.Stub(e => e.CharacteristicsLibraries).Return(new List <ITypeLibraryElement>());
            this.services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(cfgSvc);
            this.services.Stub(s => s.GetService(typeof(IFileSystemService))).Return(fsSvc);
            this.services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tllSvc);
            this.frame = new Frame(arch.FramePointerType);
        }
コード例 #10
0
 private void Given_TypeLibraryLoaderService()
 {
     tlSvc = repository.StrictMock<ITypeLibraryLoaderService>();
     sc.AddService(typeof(ITypeLibraryLoaderService), tlSvc);
 }
コード例 #11
0
        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();
        }
コード例 #12
0
        private void Given_MainFormInteractor()
        {
            program       = CreateFakeProgram();
            svcFactory    = mr.StrictMock <IServiceFactory>();
            archSvc       = mr.StrictMock <IArchiveBrowserService>();
            dlgFactory    = mr.StrictMock <IDialogFactory>();
            uiSvc         = mr.StrictMock <IDecompilerShellUiService>();
            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>();
            vimpSvc       = mr.StrictMock <IViewImportsService>();
            symLdrSvc     = mr.StrictMock <ISymbolLoadingService>();

            svcFactory.Stub(s => s.CreateArchiveBrowserService()).Return(archSvc);
            svcFactory.Stub(s => s.CreateDecompilerConfiguration()).Return(new FakeDecompilerConfiguration());
            svcFactory.Stub(s => s.CreateDiagnosticsService(Arg <ListView> .Is.Anything)).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.CreateInitialPageInteractor()).Return(new FakeInitialPageInteractor());
            svcFactory.Stub(s => s.CreateScannedPageInteractor()).Return(new FakeScannedPageInteractor());
            svcFactory.Stub(s => s.CreateAnalyzedPageInteractor()).Return(new FakeAnalyzedPageInteractor());
            svcFactory.Stub(s => s.CreateFinalPageInteractor()).Return(new FakeFinalPageInteractor());
            svcFactory.Stub(s => s.CreateTypeLibraryLoaderService()).Return(typeLibSvc);
            svcFactory.Stub(s => s.CreateProjectBrowserService(Arg <ITreeView> .Is.NotNull)).Return(brSvc);
            svcFactory.Stub(s => s.CreateUiPreferencesService()).Return(uiPrefs);
            svcFactory.Stub(s => s.CreateFileSystemService()).Return(fsSvc);
            svcFactory.Stub(s => s.CreateShellUiService(Arg <IMainForm> .Is.NotNull, Arg <DecompilerMenus> .Is.NotNull)).Return(uiSvc);
            svcFactory.Stub(s => s.CreateTabControlHost(Arg <TabControl> .Is.NotNull)).Return(tcHostSvc);
            svcFactory.Stub(s => s.CreateLoader()).Return(loader);
            svcFactory.Stub(s => s.CreateSearchResultService(Arg <ListView> .Is.NotNull)).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(symLdrSvc);
            services.AddService(typeof(IDialogFactory), dlgFactory);
            services.AddService(typeof(IServiceFactory), svcFactory);
            brSvc.Stub(b => b.Clear());

            form = mr.StrictMock <IMainForm>();
            var listView       = new ListView();
            var imagelist      = new ImageList();
            var tabResults     = new TabPage();
            var tabDiagnostics = new TabPage();
            var tabControl     = new TabControl {
                TabPages = { tabResults, tabDiagnostics }
            };
            var toolStrip   = new ToolStrip {
            };
            var statusStrip = new StatusStrip {
                Items = { new ToolStripLabel() }
            };
            var brToolbar      = new ToolStrip();
            var projectBrowser = mr.Stub <ITreeView>();

            form.Stub(f => f.DiagnosticsList).Return(listView);
            form.Stub(f => f.ImageList).Return(imagelist);
            form.Stub(f => f.Menu).SetPropertyAndIgnoreArgument();
            form.Stub(f => f.AddToolbar(null)).IgnoreArguments();
            form.Stub(f => f.AddProjectBrowserToolbar(null)).IgnoreArguments();
            form.Stub(f => f.Dispose());
            form.Stub(f => f.TabControl).Return(tabControl);
            form.Stub(f => f.FindResultsPage).Return(tabResults);
            form.Stub(f => f.DiagnosticsPage).Return(tabDiagnostics);
            form.Stub(f => f.FindResultsList).Return(listView);
            form.Stub(f => f.ToolBar).Return(toolStrip);
            form.Stub(f => f.ProjectBrowserToolbar).Return(toolStrip);
            form.Stub(f => f.ProjectBrowser).Return(projectBrowser);
            form.Stub(f => f.StatusStrip).Return(statusStrip);
            form.Stub(f => f.AddProjectBrowserToolbar(null)).IgnoreArguments();
            form.Stub(f => f.ProjectBrowserToolbar).Return(brToolbar);
            form.Stub(f => f.TitleText = "main.exe ").IgnoreArguments();
            form.Load += null;
            LastCall.IgnoreArguments();
            form.Closed += null;
            LastCall.IgnoreArguments();
            form.ProcessCommandKey += null;
            LastCall.IgnoreArguments();
            dlgFactory.Stub(d => d.CreateMainForm()).Return(form);
            tcHostSvc.Stub(t => t.Attach(Arg <IWindowPane> .Is.NotNull, Arg <TabPage> .Is.NotNull));
            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>());
        }
コード例 #13
0
 public void Setup()
 {
     this.mr = new MockRepository();
     this.arch = mr.Stub<IProcessorArchitecture>();
     this.services = mr.Stub<IServiceProvider>();
     this.dcSvc = mr.Stub<IConfigurationService>();
     this.tlSvc = mr.Stub<ITypeLibraryLoaderService>(); 
     services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(dcSvc);
     services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tlSvc);
     dcSvc.Stub(d => d.GetArchitecture("x86-protected-32")).Return(arch);
     dcSvc.Stub(d => d.GetEnvironment("elf-neutral")).Return(new OperatingEnvironmentElement
         {
             TypeName = typeof(SysVPlatform).AssemblyQualifiedName
         });
 }
コード例 #14
0
ファイル: ProjectLoaderTests.cs プロジェクト: relaxar/reko
 private void Given_TypeLibraryLoaderService()
 {
     this.tlSvc = mr.Stub<ITypeLibraryLoaderService>();
     sc.AddService<ITypeLibraryLoaderService>(this.tlSvc);
 }
コード例 #15
0
 private void Given_TypeLibraryLoaderService()
 {
     tlSvc = mr.StrictMock <ITypeLibraryLoaderService>();
     sc.AddService(typeof(ITypeLibraryLoaderService), tlSvc);
 }
コード例 #16
0
 private void Given_TypeLibraryLoaderService()
 {
     this.tlSvc = mr.Stub <ITypeLibraryLoaderService>();
     sc.AddService <ITypeLibraryLoaderService>(this.tlSvc);
 }
コード例 #17
0
ファイル: ElfImageLoaderTests.cs プロジェクト: relaxar/reko
 public override void Setup()
 {
     base.Setup();
     this.arch = mr.Stub<IProcessorArchitecture>();
     this.arch32be = mr.Stub<IProcessorArchitecture>();
     this.tlSvc = mr.Stub<ITypeLibraryLoaderService>(); 
     sc.AddService<ITypeLibraryLoaderService>(tlSvc);
     this.arch.Name = "x86-protected-32";
     cfgSvc.Stub(d => d.GetArchitecture("x86-protected-32")).Return(arch);
     cfgSvc.Stub(d => d.GetEnvironment("elf-neutral")).Return(new OperatingEnvironmentElement
     {
         TypeName = typeof(SysVPlatform).AssemblyQualifiedName
     });
 }