protected override void Context() { base.Context(); _previousJournal = A.Fake <Core.Journal.Journal>(); _journalRetriever.Current = _previousJournal; A.CallTo(() => _journalSessionConnector.SelectJournal()).Returns(null); }
protected override void Context() { base.Context(); A.CallTo(() => _journalSessionConnector.IsConnected).Returns(true); _newJournal = new Core.Journal.Journal(); A.CallTo(() => _journalRetriever.JournalFullPath).Returns("XXX"); A.CallTo(() => _journalSessionConnector.ConnectToJournal(_journalRetriever.JournalFullPath)).Returns(_newJournal); }
private void createDefaultDiagram(Core.Journal.Journal journal) { var journalDiagram = _diagramFactory.CreateDefault(); journal.AddDiagram(journalDiagram); _databaseMediator.ExecuteCommand(new CreateJournalDiagram { Diagram = journalDiagram }); }
protected override void Context() { base.Context(); _previousJournal = new Core.Journal.Journal(); _journalRetriever.Current = _previousJournal; A.CallTo(() => _journalRetriever.JournalFullPath).Returns(string.Empty); A.CallTo(() => _journalSessionConnector.IsConnected).Returns(false); A.CallTo(() => _journalSessionConnector.ConnectToJournal(_journalRetriever.JournalFullPath)).Returns(null); }
protected override void Context() { base.Context(); _relatedItem = new RelatedItem(); _relatedItem2 = new RelatedItem(); _journalPage.AddRelatedItem(_relatedItem); _journalPage.AddRelatedItem(_relatedItem2); _journal = new Core.Journal.Journal(); _journal.AddJournalPage(_journalPage); A.CallTo(() => _dialogCreator.MessageBoxYesNo(Captions.Journal.ReallyDeleteMultipleRelatedItems, ViewResult.Yes)).Returns(ViewResult.Yes); }
private void connectTo(Core.Journal.Journal journalToConnectTo, bool showJournal) { if (journalToConnectTo == null) { return; } _journalRetriever.Current = journalToConnectTo; if (showJournal) { ShowJournal(); } }
protected override void Context() { _eventPublisher = A.Fake <IEventPublisher>(); _databaseMediator = A.Fake <IDatabaseMediator>(); _dialogCreator = A.Fake <IDialogCreator>(); _journalRetriever = A.Fake <IJournalRetriever>(); _relatedItemFactory = A.Fake <IRelatedItemFactory>(); _journal = new Core.Journal.Journal(); A.CallTo(() => _journalRetriever.Current).Returns(_journal); sut = new JournalPageTask(_databaseMediator, _eventPublisher, _dialogCreator, _relatedItemFactory); _journalPage = new JournalPage(); _journal.AddJournalPage(_journalPage); }
public void DeleteRelatedItemsFrom(Core.Journal.Journal journal, IReadOnlyList <RelatedItem> relatedItems) { if (!relatedItems.Any()) { return; } var viewResult = _dialogCreator.MessageBoxYesNo(promptForDelete(relatedItems)); if (viewResult != ViewResult.Yes) { return; } relatedItems.Each(item => deleteRelatedItemFrom(journal.JournalPageContaining(item), item)); }
public Core.Journal.Journal LoadCurrent() { var journal = new Core.Journal.Journal { FullPath = _journalSession.CurrentJournalPath }; journal.AddJournalPages(_databaseMediator.ExecuteQuery(new AllJournalPages())); journal.AddDiagrams(_databaseMediator.ExecuteQuery(new AllJournalDiagrams())); if (!journal.Diagrams.Any()) { createDefaultDiagram(journal); } journal.Edited = journal.JournalPages.OrderByDescending(x => x.UpdatedAt).FirstOrDefault(); return(journal); }
protected override void Context() { _journalPageFactory = A.Fake <IJournalPageFactory>(); _databaseMediator = A.Fake <IDatabaseMediator>(); _journalRetriever = A.Fake <IJournalRetriever>(); _eventPublisher = A.Fake <IEventPublisher>(); _journalSessionConnector = A.Fake <IJournalSessionConnector>(); _relatedItemFactory = A.Fake <IRelatedItemFactory>(); _journalPageTask = A.Fake <IJournalPageTask>(); _dialogCreator = A.Fake <IDialogCreator>(); sut = new JournalTask(_journalPageFactory, _databaseMediator, _journalRetriever, _eventPublisher, _journalSessionConnector, _relatedItemFactory, _journalPageTask, _dialogCreator); _journal = new Core.Journal.Journal(); _journalRetriever.Current = _journal; _journalPage = new JournalPage(); }
protected override void Because() { _result = sut.Load(_relativePath, _projectFullPath); }
protected override void Because() { _result = sut.Load(_fullPath); }
public void DeleteRelatedItemFrom(Core.Journal.Journal journal, RelatedItem relatedItem) { DeleteRelatedItemsFrom(journal, new[] { relatedItem }); }