Exemple #1
0
        public void TestAddRemove()
        {
            _dataSource.Setup(x => x.SelectedLogLines).Returns(new HashSet <LogLineIndex> {
                13
            });
            var logFile = new InMemoryLogSource();

            logFile.AddEmptyEntries(13);
            _dataSource.Setup(x => x.FilteredLogSource).Returns(logFile);

            _viewModel.CurrentDataSource = _dataSource.Object;
            _viewModel.AddBookmarkCommand.Execute(null);
            _viewModel.Bookmarks.Should().NotBeEmpty();
            _viewModel.EmptyStatement.Should().BeNull();

            var bookmark = _viewModel.Bookmarks.First();

            bookmark.RemoveCommand.Execute(null);
            _viewModel.Bookmarks.Should().BeEmpty();
            _viewModel.EmptyStatement.Should().Be("No Bookmarks added");;
        }
Exemple #2
0
        public void TestClearBookmarks()
        {
            _viewModel.RemoveAllBookmarksCommand.CanExecute(null).Should().BeFalse("because there are no bookmarks");
            _viewModel.Update();
            _viewModel.RemoveAllBookmarksCommand.CanExecute(null).Should().BeFalse("because there are no bookmarks");

            _dataSource.Setup(x => x.SelectedLogLines).Returns(new HashSet <LogLineIndex> {
                13
            });
            var logFile = new InMemoryLogSource();

            logFile.AddEmptyEntries(13);
            _dataSource.Setup(x => x.FilteredLogSource).Returns(logFile);

            _viewModel.CurrentDataSource = _dataSource.Object;
            _viewModel.AddBookmarkCommand.Execute(null);
            _viewModel.Bookmarks.Should().NotBeEmpty();
            _viewModel.RemoveAllBookmarksCommand.CanExecute(null).Should().BeTrue("because we now have bookmarks");

            _viewModel.RemoveAllBookmarksCommand.Execute(null);
            _viewModel.Bookmarks.Should().BeEmpty();
            _viewModel.RemoveAllBookmarksCommand.CanExecute(null).Should().BeFalse("because there are no bookmarks anymore");
        }