示例#1
0
        public async Task <License> GetLicenseAsync(string packageName, string version)
        {
            string licenseUrl = await _provider.GetLicenseUrlAsync(packageName, version);

            if (licenseUrl == null)
            {
                return(null);
            }

            string licenseText = await _reader.GetLicenseTextAsync(licenseUrl);

            if (licenseText == null)
            {
                return(null);
            }

            return(_knownLicenses
                   .FirstOrDefault(x => new DefaultComparer(licenseText).Equals(x.Text)));
        }
示例#2
0
        public async Task GetLicenseAsync()
        {
            string result = await _reader.GetLicenseTextAsync("https://github.com/lvermeulen/Flurl.Http.Xml/blob/master/LICENSE");

            Assert.True(new DefaultComparer(result).Equals("some body"));
        }