Inheritance: IFileSystemService
Example #1
0
 public void Setup()
 {
     mr = new MockRepository();
     this.services = mr.Stub<IServiceProvider>();
     var tlSvc = new TypeLibraryLoaderServiceImpl(services);
     var configSvc = mr.StrictMock<IConfigurationService>();
     var fsSvc = new FileSystemServiceImpl();
     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 => 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(new FakeDecompilerEventListener());
     services.Stub(s => s.GetService(typeof(CancellationTokenSource))).Return(null);
     services.Stub(s => s.GetService(typeof(IFileSystemService))).Return(new FileSystemServiceImpl());
     services.Replay();
     configSvc.Replay();
     arch = new IntelArchitecture(ProcessorMode.Protected32);
     win32 = new Reko.Environments.Windows.Win32Platform(services, arch);
 }
Example #2
0
 private void RunFileTestx86_32(string relativePath, string outputFile)
 {
     Program program;
     var sc = new ServiceContainer();
     var fsSvc = new FileSystemServiceImpl();
     var el = new FakeDecompilerEventListener();
     sc.AddService<IFileSystemService>(fsSvc);
     sc.AddService<DecompilerEventListener>(el);
     var arch = new X86ArchitectureFlat32();
     var asm = new X86TextAssembler(sc, arch);
     using (var rdr = new StreamReader(FileUnitTester.MapTestPath(relativePath)))
     {
         var platform = new DefaultPlatform(sc, arch);
         asm.Platform = platform;
         program = asm.Assemble(Address.Ptr32(0x10000000), rdr);
     }
     var scanner = new Scanner(program, new Dictionary<Address, ProcedureSignature>(), null, sc);
     scanner.EnqueueEntryPoint(new EntryPoint(program.Image.BaseAddress, arch.CreateProcessorState()));
     scanner.ScanImage();
     using (var fut = new FileUnitTester(outputFile))
     {
         foreach (var proc in program.Procedures.Values)
         {
             proc.Write(false, fut.TextWriter);
         }
         fut.AssertFilesEqual();
     }
 }
 public void FS_MakeRelative_1()
 {
     fs = new FileSystemServiceImpl('/');
     Assert.AreEqual("ax", fs.MakeRelativePath("/home/ox", "/home/ax"));
 }