示例#1
0
        private void Given_MsDosRawFileFormat()
        {
            this.x86arch = mr.Stub <IProcessorArchitecture>();
            var env = mr.Stub <OperatingEnvironment>();

            this.msdosPlatform = mr.Stub <IPlatform>();
            var state   = mr.Stub <ProcessorState>();
            var rawFile = new RawFileElementImpl
            {
                BaseAddress  = "0C00:0100",
                Environment  = "ms-dos",
                Architecture = "x86-real-16",
            };

            rawFile.EntryPoint.Address = null;
            rawFile.EntryPoint.Name    = "Start_Here";
            cfgSvc.Stub(d => d.GetRawFile("ms-dos-com")).Return(rawFile);
            cfgSvc.Stub(d => d.GetArchitecture("x86-real-16")).Return(x86arch);
            cfgSvc.Stub(d => d.GetEnvironment("ms-dos")).Return(env);
            env.Stub(e => e.Load(null, null)).IgnoreArguments().Return(msdosPlatform);
            x86arch.Stub(a => a.TryParseAddress(
                             Arg <string> .Is.Equal("0C00:0100"),
                             out Arg <Address> .Out(Address.SegPtr(0x0C00, 0x0100)).Dummy))
            .Return(true);
            x86arch.Stub(a => a.CreateProcessorState()).Return(state);
        }
示例#2
0
        private void Given_MsDosRawFileFormat()
        {
            this.x86arch = new Mock <IProcessorArchitecture>();
            var env = new Mock <OperatingEnvironment>();

            this.msdosPlatform = new Mock <IPlatform>();
            var map     = new SegmentMap(Address.SegPtr(0x0C00, 0));
            var state   = new FakeProcessorState(x86arch.Object);
            var rawFile = new RawFileElementImpl
            {
                BaseAddress  = "0C00:0100",
                Environment  = "ms-dos",
                Architecture = "x86-real-16",
            };

            rawFile.EntryPoint.Address = null;
            rawFile.EntryPoint.Name    = "Start_Here";
            cfgSvc.Setup(d => d.GetRawFile("ms-dos-com")).Returns(rawFile);
            cfgSvc.Setup(d => d.GetArchitecture("x86-real-16")).Returns(x86arch.Object);
            cfgSvc.Setup(d => d.GetEnvironment("ms-dos")).Returns(env.Object);
            env.Setup(e => e.Load(It.IsAny <IServiceProvider>(), It.IsAny <IProcessorArchitecture>()))
            .Returns(msdosPlatform.Object);

            var addr = Address.SegPtr(0x0C00, 0x0100);

            x86arch.Setup(a => a.TryParseAddress(
                              "0C00:0100",
                              out addr))
            .Returns(true);
            x86arch.Setup(a => a.CreateProcessorState()).Returns(state);
        }