示例#1
0
        public void DocumentExistsThrowsArgumentNullExceptionIfDocumentIsNull()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");
            noteBookCollection.DocumentExists("notebook", null);
        }
示例#2
0
        public void AddDocumentToNotebookThrowsArgumentNullExceptionIfNotebookNameIsNull()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");
            noteBookCollection.AddDocumentToNotebook(null, null);
        }
示例#3
0
        public void RemoveAllDocumentsThrowsArgumentNullExceptionIfNotebookNameIsNull()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");
            noteBookCollection.RemoveAllDocuments(null);
        }
示例#4
0
        static NotebookListCache()
        {
            NotebookCollection = new NotebookCollection(NotebookDao.Inst.GetAllNotebook());

            NotebookDao.Inst.NotebookCreated += NotebookListCache_NotebookCreated;
            NotebookDao.Inst.NotebookModified += NotebookListCache_NotebookModified;
        }
示例#5
0
        public void RemoveDocumentThrowsArgumentNullExceptionIfDocumentIsNull()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");
            noteBookCollection.RemoveDocument("notebook", null);
        }
示例#6
0
        public void DocumenCountThrowsArgumentNullExceptionIfNotebookNameIsNull()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");
            noteBookCollection.DocumentCount(null);
        }
示例#7
0
        public void CreateNoteBookInsertsNoteBookIntoCollection()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("myNoteBook");

            Assert.AreEqual(1, noteBookCollection.CountNoteBooks);
        }
示例#8
0
        public NotebookList()
        {
            InitializeComponent();

            NeedSaveSelectedNotebook = true;

            _notebookSource = NotebookListCache.GetNotebookCollection();
            lbNotebook.ItemsSource = _notebookSource;
        }
示例#9
0
        public void RetrieveNotebookReturnsNamesNotebook()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("myNoteBook1");
            noteBookCollection.CreateNotebook("myNoteBook2");

            Assert.IsNotNull(noteBookCollection.RetrieveNoteBook("myNoteBook1"));
        }
示例#10
0
        public void RetrieveNotebookThrowsArgumentNullExceptionIfNotebookNameIsNull()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("myNoteBook1");
            noteBookCollection.CreateNotebook("myNoteBook2");

            noteBookCollection.RetrieveNoteBook("myNoteBook3");
        }
示例#11
0
        public void RemoveNoteBookSuccessfullyRemovesNotebook()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("Exists");
            noteBookCollection.RemoveNotebook("Exists");

            Assert.AreEqual(0, noteBookCollection.CountNoteBooks);
        }
示例#12
0
        public NotebookList()
        {
            InitializeComponent();

            NeedSaveSelectedNotebook = true;

            _notebookSource        = NotebookListCache.GetNotebookCollection();
            lbNotebook.ItemsSource = _notebookSource;
        }
示例#13
0
        public void CreateNoteBookThrowsInvalidOperationExceptionIfYouTryToInserTwoNotebooksOfTheSameName()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("myNoteBook");
            noteBookCollection.CreateNotebook("myNoteBook");

            Assert.AreEqual(2, noteBookCollection.CountNoteBooks);
        }
示例#14
0
        public void RetrieveNotebookNamesReturnsListofNotebookNames()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");
            noteBookCollection.CreateNotebook("notebook2");
            noteBookCollection.CreateNotebook("notebook3");

            Assert.AreEqual(3, noteBookCollection.RetrieveNotebookNames().Count);
        }
示例#15
0
        public void DocumentCountToNotebookAddsDocumentToNoteBook()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");

            var document = new Document(@"c:\fileExists.scp", "myDocument1", new TestFileProxy());

            noteBookCollection.AddDocumentToNotebook("notebook", document);

            Assert.AreEqual(1, noteBookCollection.DocumentCount("notebook"));
        }
示例#16
0
        public void AddDocumentsToNotebookAdds2DocumentsToNoteBook()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");

            var document  = new Document(@"c:\fileExists.scp", "myDocument1", new TestFileProxy());
            var document2 = new Document(@"c:\fileExists.scp", "myDocument2", new TestFileProxy());

            noteBookCollection.AddDocumentToNotebook("notebook", document);
            noteBookCollection.AddDocumentToNotebook("notebook", document2);

            Assert.IsTrue(noteBookCollection.DocumentExists("notebook", document));
            Assert.IsTrue(noteBookCollection.DocumentExists("notebook", document2));
        }
示例#17
0
        public void RemoveDocumentFromNotebookThrowsInvalidOperationExceptionIfDocumentDoesntExist()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");

            var document  = new Document(@"c:\fileExists.scp", "myDocument1", new TestFileProxy());
            var document2 = new Document(@"c:\fileExists.scp", "myDocument2", new TestFileProxy());
            var document3 = new Document(@"c:\fileExists.scp", "DoesNotExist", new TestFileProxy());

            noteBookCollection.AddDocumentToNotebook("notebook", document);
            noteBookCollection.AddDocumentToNotebook("notebook", document2);

            Assert.AreEqual(2, noteBookCollection.DocumentCount("notebook"));

            noteBookCollection.RemoveDocument("notebook", document3);
        }
示例#18
0
        public void RemoveAllDocumentsFromNotebookRemovesAllDocuments()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.CreateNotebook("notebook");

            var document  = new Document(@"c:\fileExists.scp", "myDocument1", new TestFileProxy());
            var document2 = new Document(@"c:\fileExists.scp", "myDocument2", new TestFileProxy());

            noteBookCollection.AddDocumentToNotebook("notebook", document);
            noteBookCollection.AddDocumentToNotebook("notebook", document2);

            Assert.AreEqual(2, noteBookCollection.DocumentCount("notebook"));

            noteBookCollection.RemoveAllDocuments("notebook");

            Assert.AreEqual(0, noteBookCollection.DocumentCount("notebook"));
        }
示例#19
0
 public void Init()
 {       
     Notebooks = new NotebookCollection();
     Notebooks.Load();
     var c = Notebooks.FirstOrDefault(k=>k.Name == Notebooks.ActiveNotebookConfig);
     if (c != null) Notebooks.ActiveNotebook = c;
     if (Notebooks.ActiveNotebook == null && Notebooks.Any()) Notebooks.ActiveNotebook = Notebooks[0];
 }
示例#20
0
        public void RemoveNoteBookThrowsArgumentNullExceptionIfNotebookNameIsNull()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.RemoveNotebook(null);
        }
示例#21
0
        public void RemoveNoteBookThrowsInvalidOperationExceptionIfNoteBookDoesNotExist()
        {
            var noteBookCollection = new NotebookCollection();

            noteBookCollection.RemoveNotebook("Not Exists");
        }