public void TestInitialise() { this.factory = new Container(); this.mockFileManager = MockRepository.GenerateMock<IFileManager>(); this.mockController = MockRepository.GenerateMock<IDiagramController>(); this.fakeDiagram = new Diagram(this.mockController); factory.Configure(config => config.For<IFileManager>().Use(this.mockFileManager)); this.mockFileManager.Expect(m => m.LoadDemoType()).IgnoreArguments().Return(demoType); var harness = new ShellControllerTestHarness(factory) { CreateController = () => this.mockController, CurrentView = this.fakeDiagram, }; this.target = harness; }
private void OnTabCloseExecute(Diagram diagram) { if (OpenViews.Count == 1) { ExitCommand.Execute(null); return; } if (OpenViews.Contains(diagram)) { OpenViews.Remove(diagram); } if (CurrentView == diagram) { CurrentView = OpenViews.First(); } diagram.Controller.Cleanup(); var disposable = diagram.Controller as IDisposable; if (disposable != null) { disposable.Dispose(); } }
/// <summary> /// Gives a reference of the diagram container to the controller. This must be called prior to loading any content in the diagram. /// Should not be used externally, the diagram constructor must be the only caller of this. /// </summary> /// <param name="diagram">The new host diagram.</param> public void SetHostDiagram(Diagram diagram) { if (this.hostDiagram != null) { throw new InvalidOperationException("Code Error: You cannot call Set Host Diagram twice."); } this.hostDiagram = diagram; }
public void PositionMainSubject(Diagram hostDiagram) { MainDrawingSubject.CenterOnPoint(hostDiagram.Centre); }