public void SaveJournalDiagram(JournalDiagram journalDiagram) { _databaseMediator.ExecuteCommand(new UpdateJournalDiagram { Diagram = journalDiagram }); _eventPublisher.PublishEvent(new JournalDiagramUpdatedEvent(journalDiagram)); }
protected override void Context() { base.Context(); _fullPath = "AA"; _defaultDiagram = new JournalDiagram(); A.CallTo(() => _diagramFactory.CreateDefault()).Returns(_defaultDiagram); A.CallTo(() => _journalSession.TryOpen(_fullPath)).Returns(true); A.CallTo(() => _databaseMediator.ExecuteQuery(A <AllJournalDiagrams> ._)).Returns(Enumerable.Empty <JournalDiagram>()); }
protected override void Context() { base.Context(); _journalDiagram = new JournalDiagram(); A.CallTo(() => _databaseMediator.ExecuteCommand(A <UpdateJournalDiagram> ._)) .Invokes(x => _payload = x.GetArgument <UpdateJournalDiagram>(0)); A.CallTo(() => _eventPublisher.PublishEvent(A <JournalDiagramUpdatedEvent> ._)) .Invokes(x => _event = x.GetArgument <JournalDiagramUpdatedEvent>(0)); }
public void should_return_all_available_journal_diagrams() { var diagram = new JournalDiagram { Name = "TOTO", DiagramModel = new DiagramModelForSpecs() }; _databaseMediator.ExecuteCommand(new CreateJournalDiagram { Diagram = diagram }); var allWorkingJournalDiagrams = _databaseMediator.ExecuteQuery(new AllJournalDiagrams()); var diagramFromDb = allWorkingJournalDiagrams.ElementAt(0); diagramFromDb.Name.ShouldBeEqualTo("TOTO"); diagramFromDb.DiagramModel.ShouldNotBeNull(); }
protected override void Context() { base.Context(); _fullPath = "AA"; _wji1 = new JournalPage { UpdatedAt = DateTime.Today }; _wji2 = new JournalPage { UpdatedAt = DateTime.Today + TimeSpan.FromDays(1) }; _diagram1 = new JournalDiagram(); _diagram2 = new JournalDiagram(); A.CallTo(() => _journalSession.TryOpen(_fullPath)).Returns(true); A.CallTo(() => _databaseMediator.ExecuteQuery(A <AllJournalPages> ._)).Returns(new[] { _wji1, _wji2 }); A.CallTo(() => _databaseMediator.ExecuteQuery(A <AllJournalDiagrams> ._)).Returns(new[] { _diagram1, _diagram2 }); A.CallTo(() => _journalSession.CurrentJournalPath).Returns(_fullPath); }
protected override void Context() { _journalTask = A.Fake <IJournalTask>(); _view = A.Fake <IJournalDiagramView>(); _reloadRelatedItemTask = A.Fake <IReloadRelatedItemTask>(); var journalComparisonTask = A.Fake <IJournalComparisonTask>(); _multipleBaseNodeContextMenuFactory = A.Fake <IMultipleBaseNodeContextMenuFactory>(); _journalPageTask = A.Fake <IJournalPageTask>(); _userSettings = A.Fake <IPresentationUserSettings>(); _dialogCreator = A.Fake <IDialogCreator>(); _containerBaseLayouter = A.Fake <IContainerBaseLayouter>(); _viewItemContextMenuFactory = A.Fake <IViewItemContextMenuFactory>(); _diagramModelFactory = A.Fake <IDiagramModelFactory>(); sut = new JournalDiagramPresenter(_view, _containerBaseLayouter, _dialogCreator, _diagramModelFactory, _userSettings, _journalTask, _journalPageTask, _reloadRelatedItemTask, journalComparisonTask, _multipleBaseNodeContextMenuFactory, _viewItemContextMenuFactory); _journal = new Journal(); _journalDiagram = new JournalDiagram().WithName(global::OSPSuite.Assets.Captions.Journal.DefaultDiagramName); _journal.AddDiagram(_journalDiagram); _journalDiagram.DiagramManager = A.Fake <IDiagramManager <JournalDiagram> >(); _journalDiagram.DiagramModel = A.Fake <IDiagramModel>(); sut.Handle(new JournalLoadedEvent(_journal)); }
protected override void Because() { _result = sut.Create("XX"); }