public TheToggleTagSuggestionsCommand() { var tag = Substitute.For <IDatabaseTag>(); tag.Id.Returns(TagId); tag.Name.Returns(TagName); var suggestions = TagSuggestion.FromTags(new[] { tag }); AutocompleteProvider .Query(Arg.Is <TextFieldInfo>(info => info.Text.Contains("#"))) .Returns(Observable.Return(suggestions)); }
public TheToggleProjectSuggestionsCommand() { var suggestions = ProjectSuggestion.FromProjectsPrependingEmpty(Enumerable.Empty <IDatabaseProject>()); AutocompleteProvider .Query(Arg.Is <TextFieldInfo>(info => info.Text.Contains("@"))) .Returns(Observable.Return(suggestions)); AutocompleteProvider .Query(Arg.Any <string>(), Arg.Is(AutocompleteSuggestionType.Projects)) .Returns(Observable.Return(suggestions)); }
public async Task ReturnsFalseIfHasProjectsButFilteredProjectCollectionDoesNot() { var projects = Enumerable.Range(0, 5) .Select(createArbitraryProject) .ToList(); DataSource.Projects.GetAll().Returns(Observable.Return(projects)); AutocompleteProvider .Query(Arg.Is <QueryInfo>(arg => arg.SuggestionType == AutocompleteSuggestionType.Projects)) .Returns(Observable.Return(new List <ProjectSuggestion>())); ViewModel.Prepare(SelectProjectParameter.WithIds(null, null, workspaceId)); await ViewModel.Initialize(); ViewModel.Text = "Anything"; ViewModel.IsEmpty.Should().BeFalse(); }