Esempio n. 1
0
        public void Setup()
        {
            mr            = new MockRepository();
            eventListener = new FakeDecompilerEventListener();
            this.services = mr.Stub <IServiceProvider>();
            var tlSvc     = new TypeLibraryLoaderServiceImpl(services);
            var configSvc = mr.StrictMock <IConfigurationService>();
            var win32env  = new OperatingEnvironmentElement
            {
                TypeLibraries =
                {
                    new TypeLibraryElement {
                        Name = "msvcrt.xml"
                    },
                    new TypeLibraryElement {
                        Name = "windows32.xml"
                    },
                }
            };

            configSvc.Stub(c => c.GetEnvironment("win32")).Return(win32env);
            configSvc.Stub(c => c.GetInstallationRelativePath(null)).IgnoreArguments()
            .Do(new Func <string[], string>(s => RekoConfigurationService.MakeInstallationRelativePath(s)));
            services.Stub(s => s.GetService(typeof(ITypeLibraryLoaderService))).Return(tlSvc);
            services.Stub(s => s.GetService(typeof(IConfigurationService))).Return(configSvc);
            services.Stub(s => s.GetService(typeof(DecompilerEventListener))).Return(eventListener);
            services.Stub(s => s.GetService(typeof(CancellationTokenSource))).Return(null);
            services.Stub(s => s.GetService(typeof(IFileSystemService))).Return(new FileSystemServiceImpl());
            services.Stub(s => s.GetService(typeof(IDiagnosticsService))).Return(new FakeDiagnosticsService());
            services.Replay();
            configSvc.Replay();
            arch  = new X86ArchitectureFlat32("x86-protected-32");
            win32 = new Reko.Environments.Windows.Win32Platform(services, arch);
        }
Esempio n. 2
0
        public void Setup()
        {
            eventListener = new FakeDecompilerEventListener();
            this.services = new ServiceContainer();
            var tlSvc     = new TypeLibraryLoaderServiceImpl(services);
            var configSvc = new Mock <IConfigurationService>();
            var win32env  = new PlatformDefinition
            {
                TypeLibraries =
                {
                    new TypeLibraryDefinition {
                        Name = "msvcrt.xml"
                    },
                    new TypeLibraryDefinition {
                        Name = "windows32.xml"
                    },
                }
            };

            configSvc.Setup(c => c.GetEnvironment("win32")).Returns(win32env);
            configSvc.Setup(c => c.GetInstallationRelativePath(It.IsAny <string>()))
            .Returns((string[] s) => RekoConfigurationService.MakeInstallationRelativePath(s));
            services.AddService(typeof(ITypeLibraryLoaderService), tlSvc);
            services.AddService(typeof(IConfigurationService), configSvc.Object);
            services.AddService(typeof(DecompilerEventListener), eventListener);
            services.AddService(typeof(CancellationTokenSource), new CancellationTokenSource());
            services.AddService(typeof(IFileSystemService), new FileSystemServiceImpl());
            services.AddService(typeof(IDiagnosticsService), new FakeDiagnosticsService());
            arch  = new X86ArchitectureFlat32("x86-protected-32");
            win32 = new Reko.Environments.Windows.Win32Platform(services, arch);
        }