public void IsBuildIncludedInternalIsNotCalledForWhitespaceInput(string input) { var criteria = new TestSearchCriteria(Substitute.For <IPipeline>()); criteria.IsBuildIncluded(Substitute.For <IBuild>(), input); Assert.Equal(0, criteria.IsBuildIncludedInternalReceivedCalls.Count); }
public void IsBuildIncludedInternalIsTrueForWhitespaceInput(string input) { var criteria = new TestSearchCriteria(Substitute.For <IPipeline>()); var result = criteria.IsBuildIncluded(Substitute.For <IBuild>(), input); Assert.True(result); }
public void InputIsTrimmedOfSpacesForSuggestInternal(string input, string expectedResult) { var criteria = new TestSearchCriteria(Substitute.For <IPipeline>()); criteria.Suggest(input); Assert.Equal(expectedResult, criteria.SuggestInternalReceivedCalls.First().input); }
public void UpdateCacheIsNotCalledWhenPipelineHasNoRecentUpdate() { var pipeline = Substitute.For <IPipeline>(); var criteria = new TestSearchCriteria(Substitute.For <IPipeline>()); var anyBuild = Substitute.For <IBuild>(); pipeline.LastUpdate.Returns(DateTime.MinValue); criteria.IsBuildIncluded(anyBuild, string.Empty); var receivedCalls = criteria.UpdateCacheForSuggestionsReceivedCalls.Count; Assert.Equal(0, receivedCalls); }
public void UpdateCacheIsOnlyCalledOnceWhenPipelineUpdateIsMoreRecent() { var pipeline = Substitute.For <IPipeline>(); pipeline.LastUpdate.Returns(DateTime.Now); var criteria = new TestSearchCriteria(pipeline); criteria.Suggest("validSearchTerm"); criteria.Suggest("validSearchTerm"); criteria.Suggest("validSearchTerm"); var receivedCalls = criteria.UpdateCacheForSuggestionsReceivedCalls.Count; Assert.Equal(1, receivedCalls); }