public void Cvp_CreateProcedureViewerIfNotVisible() { var m = new ProcedureBuilder(); m.Return(); var uiSvc = AddMockService <IDecompilerShellUiService>(); uiSvc.Setup(s => s.FindDocumentWindow( "CombinedCodeViewInteractor", m.Procedure)) .Returns((IWindowFrame)null) .Verifiable(); var windowPane = new Mock <CombinedCodeViewInteractor>(); var windowFrame = new Mock <IWindowFrame>(); windowFrame.Setup(f => f.Pane).Returns(windowPane.Object); uiSvc.Setup(s => s.CreateDocumentWindow( "CombinedCodeViewInteractor", m.Procedure, m.Procedure.Name, It.IsAny <IWindowPane>())) .Returns(windowFrame.Object) .Verifiable(); windowFrame.Setup(s => s.Show()) .Verifiable(); var codeViewerSvc = new CodeViewerServiceImpl(sc); codeViewerSvc.DisplayProcedure(program, m.Procedure, true); uiSvc.VerifyAll(); windowFrame.VerifyAll(); }
public void Cvp_CreateProcedureViewerIfNotVisible() { var m = new ProcedureBuilder(); m.Return(); var uiSvc = AddMockService <IDecompilerShellUiService>(); uiSvc.Expect(s => s.FindDocumentWindow( "CombinedCodeViewInteractor", m.Procedure)) .Return(null); var windowPane = mr.Stub <CombinedCodeViewInteractor>(); var windowFrame = mr.StrictMock <IWindowFrame>(); windowFrame.Stub(f => f.Pane).Return(windowPane); uiSvc.Expect(s => s.CreateDocumentWindow( Arg <string> .Is.Equal("CombinedCodeViewInteractor"), Arg <string> .Is.Equal(m.Procedure), Arg <string> .Is.Equal(m.Procedure.Name), Arg <IWindowPane> .Is.Anything)) .Return(windowFrame); windowFrame.Expect(s => s.Show()); mr.ReplayAll(); var codeViewerSvc = new CodeViewerServiceImpl(sc); codeViewerSvc.DisplayProcedure(program, m.Procedure, true); uiSvc.VerifyAllExpectations(); }
public void Cvp_CreateViewerIfNotVisible() { var m = new ProcedureBuilder(); m.Return(); var uiSvc = AddMockService <IDecompilerShellUiService>(); uiSvc.Expect(s => s.FindDocumentWindow( "codeViewerWindow", m.Procedure)) .Return(null); var windowFrame = MockRepository.GenerateStub <IWindowFrame>(); uiSvc.Expect(s => s.CreateDocumentWindow( Arg <string> .Is.Equal("codeViewerWindow"), Arg <string> .Is.Equal(m.Procedure), Arg <string> .Is.Equal(m.Procedure.Name), Arg <IWindowPane> .Is.Anything)) .Return(windowFrame); windowFrame.Expect(s => s.Show()); var codeViewerSvc = new CodeViewerServiceImpl(sc); codeViewerSvc.DisplayProcedure(program, m.Procedure); uiSvc.VerifyAllExpectations(); }