Ejemplo n.º 1
0
        public async Task ExecuteReturnsResultsForSpecificQuery()
        {
            var query  = new AutocompleteServicePackageVersionsQuery(GetConfiguration(), GetResilientSearchClient());
            var result = await query.Execute("newtonsoft.json", false);

            Assert.True(result.Any());
        }
 public async Task ExecuteReturnsResultsForSpecificQuery()
 {
     var query = new AutocompleteServicePackageVersionsQuery(GetConfiguration());
     var result = await query.Execute("newtonsoft.json", false);
     Assert.NotEmpty(result);
     Assert.True(result.Any());
 }
        public async Task ExecuteThrowsForEmptyId()
        {
            var query = new AutocompleteServicePackageVersionsQuery(GetConfiguration(), GetResilientSearchClient());
            await Assert.ThrowsAsync <ArgumentNullException>(async() => await query.Execute(string.Empty, false));

            Assert.Empty(_testHandler.Requests);
        }
        public async Task ExecuteReturnsResultsForSpecificQuery()
        {
            var query  = new AutocompleteServicePackageVersionsQuery(GetConfiguration(), GetResilientSearchClient());
            var result = await query.Execute("newtonsoft.json", false);

            Assert.True(result.Any());
            var request = Assert.Single(_testHandler.Requests);

            Assert.Equal("https://example/autocomplete?id=newtonsoft.json&prerelease=False", request.RequestUri.AbsoluteUri);
        }
Ejemplo n.º 5
0
        public void PackageVersionsQueryBuildsCorrectQueryString(bool includePrerelease, string semVerLevel, string expectedQueryString)
        {
            // Arrange
            var query = new AutocompleteServicePackageVersionsQuery(GetConfiguration(), GetResilientSearchClient());

            // Act
            var actualQueryString = query.BuildQueryString("id=Newtonsoft.Json", includePrerelease, semVerLevel);

            // Assert
            Assert.Equal(expectedQueryString, actualQueryString);
        }
 public async Task ExecuteThrowsForEmptyId()
 {
     var query = new AutocompleteServicePackageVersionsQuery(GetConfiguration());
     await Assert.ThrowsAsync<ArgumentNullException>(async () => await query.Execute("", false));
 }
Ejemplo n.º 7
0
 public async Task ExecuteThrowsForEmptyId()
 {
     var query = new AutocompleteServicePackageVersionsQuery(GetConfiguration());
     await Assert.ThrowsAsync <ArgumentNullException>(async() => await query.Execute("", false));
 }