Пример #1
0
        public void NavigateToAddress()
        {
            var project = new Project {
                Programs = { program }
            };
            var memSvc = mr.DynamicMock <ILowLevelViewService>();
            var decSvc = mr.DynamicMock <IDecompilerService>();
            var dec    = mr.DynamicMock <IDecompiler>();

            memSvc.Expect(x => x.ShowMemoryAtAddress(
                              Arg <Program> .Is.NotNull,
                              Arg <Address> .Matches(a => a.ToLinear() == 0x1234)));
            decSvc.Stub(d => d.Decompiler).Return(dec);
            dec.Stub(d => d.Project).Return(project);
            mr.ReplayAll();

            var sc = new ServiceContainer();

            sc.AddService <ILowLevelViewService>(memSvc);
            sc.AddService <IDecompilerService>(decSvc);
            var nav = new AddressNavigator(program, Address.Ptr32(0x1234), sc);

            nav.NavigateTo();

            mr.VerifyAll();
        }
Пример #2
0
        public void NavigateToAddress()
        {
            var project = new Project {
                Programs = { program }
            };
            var memSvc = new Mock <ILowLevelViewService>();
            var decSvc = new Mock <IDecompilerService>();
            var dec    = new Mock <IDecompiler>();

            memSvc.Setup(x => x.ShowMemoryAtAddress(
                             It.IsNotNull <Program>(),
                             It.Is <Address>(a => a.ToLinear() == 0x1234))).Verifiable();
            decSvc.Setup(d => d.Decompiler).Returns(dec.Object);
            dec.Setup(d => d.Project).Returns(project);

            var sc = new ServiceContainer();

            sc.AddService <ILowLevelViewService>(memSvc.Object);
            sc.AddService <IDecompilerService>(decSvc.Object);
            var nav = new AddressNavigator(program, Address.Ptr32(0x1234), sc);

            nav.NavigateTo();

            memSvc.VerifyAll();
        }