public async Task UsesGetProjectsAutocompleteSuggestionsInteractorWhenTheAtSymbolIsTyped(string description) { var actualDescription = $"{description} @{description}"; var textFieldInfo = TextFieldInfo.Empty(1) .ReplaceSpans(new QueryTextSpan(actualDescription, description.Length + 2)); var interactor = new GetAutocompleteSuggestions(InteractorFactory, QueryInfo.ParseFieldInfo(textFieldInfo)); await interactor.Execute(); InteractorFactory .Received() .GetProjectsAutocompleteSuggestions(Arg.Is <IList <string> >( words => words.SequenceEqual(description.SplitToQueryWords()))); }
public async Task WhenTheUserBeginsTypingADescription(string description) { var textFieldInfo = TextFieldInfo.Empty(1) .ReplaceSpans(new QueryTextSpan(description, 0)); var interactor = new GetAutocompleteSuggestions(InteractorFactory, QueryInfo.ParseFieldInfo(textFieldInfo)); await interactor.Execute(); InteractorFactory .Received() .GetTimeEntriesAutocompleteSuggestions(Arg.Is <IList <string> >( words => words.SequenceEqual(description.SplitToQueryWords())) ); }
public async Task WhenTheUserHasTypedAnySearchSymbolsButMovedTheCaretToAnIndexThatComesBeforeTheSymbol( string description) { var actualDescription = $"{description} @{description}"; var textFieldInfo = TextFieldInfo.Empty(1) .ReplaceSpans(new QueryTextSpan(actualDescription, 0)); var interactor = new GetAutocompleteSuggestions(InteractorFactory, QueryInfo.ParseFieldInfo(textFieldInfo)); await interactor.Execute(); InteractorFactory .Received() .GetTimeEntriesAutocompleteSuggestions(Arg.Is <IList <string> >( words => words.SequenceEqual(actualDescription.SplitToQueryWords()))); }
public async Task WhenTheUserHasAlreadySelectedAProjectAndTypesTheAtSymbol() { var description = $"Testing Mobile Apps @toggl"; var textFieldInfo = TextFieldInfo.Empty(1).ReplaceSpans( new QueryTextSpan(description, description.Length), new ProjectSpan(ProjectId, ProjectName, ProjectColor) ); var interactor = new GetAutocompleteSuggestions(InteractorFactory, QueryInfo.ParseFieldInfo(textFieldInfo)); await interactor.Execute(); InteractorFactory .Received() .GetTimeEntriesAutocompleteSuggestions(Arg.Is <IList <string> >( words => words.SequenceEqual(description.SplitToQueryWords()))); }
public async Task DoesNotUseInteractorsWhenTheSarchStringIsEmpty() { var textFieldInfo = TextFieldInfo.Empty(1).ReplaceSpans(new QueryTextSpan()); var interactor = new GetAutocompleteSuggestions(InteractorFactory, QueryInfo.ParseFieldInfo(textFieldInfo)); await interactor.Execute(); InteractorFactory .DidNotReceive() .GetTagsAutocompleteSuggestions(Arg.Any <IList <string> >()); InteractorFactory .DidNotReceive() .GetProjectsAutocompleteSuggestions(Arg.Any <IList <string> >()); InteractorFactory .DidNotReceive() .GetTimeEntriesAutocompleteSuggestions(Arg.Any <IList <string> >()); }