public void NewHistoryIsEmpty() { var history = new RuntimeSearchHistory(); var entries = history.SearchedTerms(); Assert.Empty(entries); }
public void AddingEntryToHistoryWillYieldThisEntry() { var history = new RuntimeSearchHistory(); const string expectedTerm = "anything"; history.AddEntry(expectedTerm); var entries = history.SearchedTerms(); Assert.Contains(entries, e => e.Equals(expectedTerm, StringComparison.Ordinal)); }
public void RemovingTermThatIsNotInListDoesNothing() { var history = new RuntimeSearchHistory(); const string anything = nameof(anything); history.RemoveEntry(anything); var entries = history.SearchedTerms(); Assert.Empty(entries); }
public void TwiceAddedTermIsYieldedOnlyOnce() { var history = new RuntimeSearchHistory(); const string expectedTerm = "anything"; history.AddEntry(expectedTerm); history.AddEntry(expectedTerm); var entries = history.SearchedTerms(); Assert.Single(entries); }
public void RemovedTermIsNotYielded() { var history = new RuntimeSearchHistory(); const string expectedTerm = "anything"; history.AddEntry(expectedTerm); history.RemoveEntry(expectedTerm); var entries = history.SearchedTerms(); Assert.Empty(entries); }
public void ManuallyGivenDateIsRespected() { var history = new RuntimeSearchHistory(); const string oldTerm = nameof(oldTerm); const string newTerm = nameof(newTerm); history.AddEntry(oldTerm, DateTime.Now + TimeSpan.FromHours(1)); history.AddEntry(newTerm); var inOrder = new[] { oldTerm, newTerm }; var entries = history.SearchedTerms(); Assert.Equal(inOrder, entries); }
public void EntriesAreSortedByDateDescending() { var history = new RuntimeSearchHistory(); const string oldTerm = nameof(oldTerm); const string newTerm = nameof(newTerm); history.AddEntry(oldTerm); history.AddEntry(newTerm); var inOrder = new[] { newTerm, oldTerm }; var entries = history.SearchedTerms(); Assert.Equal(inOrder, entries); }
public void EntryAddedAgainWillUpdateItsUsedTime() { var history = new RuntimeSearchHistory(); const string oldTerm = nameof(oldTerm); const string newTerm = nameof(newTerm); history.AddEntry(oldTerm); history.AddEntry(newTerm); history.AddEntry(oldTerm); var newestEntry = history.SearchedTerms().First(); Assert.Equal(oldTerm, newestEntry); }
public void AddingEntriesToHistoryWillYieldTheseEntries() { var history = new RuntimeSearchHistory(); var expectedTerms = new[] { "term1", "term2" }; foreach (var term in expectedTerms) { history.AddEntry(term); } var entries = history.SearchedTerms(); Assert.Equal(expectedTerms.Reverse(), entries.ToArray()); }
public CoreSetup(IPathResolver pathResolver, IDistributedNotificationReceiver?notificationReceiver, IDispatcher uiDispatcher) { _pathResolver = pathResolver; var serializer = new Serializer(); var pluginHost = new PluginHost(uiDispatcher); var pluginLoader = new PluginLoader(pluginHost); PluginRepository = pluginLoader.LoadPlugins(pathResolver.PluginFolders); _configurationSerializer = new ConfigurationSerializer(serializer); ConfigurationBuilder = new ConfigurationBuilder(_pathResolver, _configurationSerializer); Configuration = ConfigurationBuilder.LoadConfiguration(); ProjectProvider = new ProjectProvider(Configuration, PluginRepository); UserIdentityList = new UserIdentityList(); var treeBuilder = new TreeBuilder(Configuration); Pipeline = new Pipeline.Pipeline(treeBuilder, Configuration, UserIdentityList); Pipeline.Notifier.Updated += Notifier_Updated; SearchEngine = new SearchEngine(); SearchEngine.AddCriteria(new BranchCriteria(Pipeline)); SearchEngine.AddCriteria(new DefinitionCriteria(Pipeline)); SearchEngine.AddCriteria(new IsCriteria(Pipeline)); SearchEngine.AddCriteria(new ForCriteria(Pipeline)); SearchEngine.AddCriteria(new ByCriteria(Pipeline)); SearchEngine.AddCriteria(new DuringCriteria(Pipeline)); SearchEngine.AddCriteria(new AfterCriteria(Pipeline), false); SearchEngine.AddCriteria(new BeforeCriteria(Pipeline), false); SearchHistory = new RuntimeSearchHistory(); if (notificationReceiver != null) { NotificationReceiver = notificationReceiver; NotificationReceiver.DistributedNotificationReceived += (sender, args) => DistributedNotificationReceived?.Invoke(this, args); } }