コード例 #1
0
 public void Setup()
 {
     mr = new MockRepository();
     frame = mr.DynamicMock<IWindowFrame>();
     sc = new ServiceContainer();
     sc.AddService(typeof(IWindowFrame), frame);
 }
コード例 #2
0
        public void SaveLogViewerToFile(IWindowFrame windowFrame, string filePath)
        {
            // Check if file exists; delete it
            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }

            using (FileStream fs = File.Create(filePath))
            {
                var messages = windowFrame.PrimaryView.Messages;
                lock (messages)
                {
                    foreach (var msg in messages)
                    {
                        AddText(fs, string.Format("{0}|{1}|{2}|{3}\r\n", msg.DateTime.ToString("yyyy-MM-dd HH:mm:ss.ffff"), msg.Type, msg.System, msg.Description));
                    }
                }
            }
        }
コード例 #3
0
        public void Setup()
        {
            mr = new MockRepository();
            mockFactory = new MockFactory(mr);
            var platform = mockFactory.CreatePlatform(); ;

            program = new Program
            {
                Architecture = platform.Architecture,
                Platform = platform,
            };
            codeViewer = new CodeViewerPane();
            decompilerSvc = mr.Stub<IDecompilerService>();
            decompiler = mr.Stub<IDecompiler>();
            uiPreferencesSvc = mr.Stub<IUiPreferencesService>();
            uiSvc = mr.Stub<IDecompilerShellUiService>();
            frame = mr.Stub<IWindowFrame>();
            font = new Font("Arial", 10);
            var styles = new Dictionary<string, UiStyle>()
            {
                {
                    UiStyles.CodeWindow,
                    new UiStyle
                    {
                        Background = new SolidBrush(Color.White),
                    }
                }
            };
            uiPreferencesSvc.Stub(u => u.Styles).Return(styles);
            var sc = new ServiceContainer();
            decompilerSvc.Decompiler = decompiler;
            sc.AddService<IDecompilerService>(decompilerSvc);
            sc.AddService<IUiPreferencesService>(uiPreferencesSvc);
            sc.AddService<IDecompilerShellUiService>(uiSvc);
            codeViewer.SetSite(sc);
        }
コード例 #4
0
ファイル: TabControlHost.cs プロジェクト: gitter-badger/reko
 private TabPage FindPage(IWindowFrame frame)
 {
     return tabCtrl.TabPages.Cast<TabPage>().Where(p => p.Tag == frame).FirstOrDefault();
 }
コード例 #5
0
ファイル: CodeViewerPaneTests.cs プロジェクト: nemerle/reko
        public void Setup()
        {
            mr = new MockRepository();
            program = new Program();
            codeViewer = new CodeViewerPane();
            decompilerSvc = mr.Stub<IDecompilerService>();
            decompiler = mr.Stub<IDecompiler>();
            uiPreferencesSvc = mr.Stub<IUiPreferencesService>();
            uiSvc = mr.Stub<IDecompilerShellUiService>();
            frame = mr.Stub<IWindowFrame>();
            font = new Font("Arial", 10);
            var styles = new Dictionary<string, UiStyle>();
            uiPreferencesSvc.Stub(u => u.Styles).Return(styles);

            var sc = new ServiceContainer();
            decompilerSvc.Decompiler = decompiler;
            sc.AddService<IDecompilerService>(decompilerSvc);
            sc.AddService<IUiPreferencesService>(uiPreferencesSvc);
            sc.AddService<IDecompilerShellUiService>(uiSvc);
            codeViewer.SetSite(sc);
        }