Exemplo n.º 1
0
        public async Task TestTFF()
        {
            var searchTerm      = "bla";
            var prerelease      = true;
            var allVersions     = false;
            var includeDelisted = false;
            var mock            = new PackageSearchResourceMock()
            {
                _searchTerm = searchTerm, _prerelease = prerelease, _allVersions = allVersions, _includeDelisted = includeDelisted
            };
            var resource   = new LocalPackageListResource(mock, "");
            var enumerable = await resource.ListAsync(searchTerm, prerelease, allVersions, includeDelisted, NullLogger.Instance, CancellationToken.None);

            var enumerator = enumerable.GetEnumeratorAsync();
            await enumerator.MoveNextAsync();

            AssertAll(mock);
        }
Exemplo n.º 2
0
        private void AssertAll(PackageSearchResourceMock mock)
        {
            Assert.Equal(mock._searchTerm, mock._actualSearchTerm);
            Assert.True(0 == mock._actualSkip);
            Assert.True(int.MaxValue == mock._actualTake);
            Assert.True(mock._searchFilter.OrderBy == SearchOrderBy.Id);
            if (mock._allVersions)
            {
                Assert.True(mock._searchFilter.Filter == null);
            }
            if (!mock._allVersions && mock._prerelease)
            {
                Assert.True(mock._searchFilter.Filter == SearchFilterType.IsAbsoluteLatestVersion);
            }

            if (!mock._allVersions && !mock._prerelease)
            {
                Assert.True(mock._searchFilter.Filter == SearchFilterType.IsLatestVersion);
            }

            Assert.True(mock._searchFilter.IncludeDelisted == mock._includeDelisted);
            Assert.True(mock._searchFilter.IncludePrerelease == mock._prerelease);
        }