Exemplo n.º 1
0
        public async Task <Channel> GetChannel(string appRuntimeVersion)
        {
            var allChannels = await _httpClient.GetAllChannelsAsync();

            foreach (var singleChannel in allChannels)
            {
                var isChannelContainingRuntimeRelease = singleChannel.Releases.Any(r => r.Runtime != null && r.Runtime.Version == appRuntimeVersion);
                if (isChannelContainingRuntimeRelease)
                {
                    var channel = new Channel();
                    channel.Releases.AddRange(singleChannel.Releases.Select(r =>
                    {
                        var release = new Release
                        {
                            RuntimeVersion = r.Runtime?.Version
                        };

                        if (r.Security)
                        {
                            release.Security = r.Security;
                            release.CVEs     = r.CVEs?.Select(c => new CVE
                            {
                                Id  = c.Id,
                                Url = c.Url
                            });
                        }
                        return(release);
                    }));
                    return(channel);
                }
            }

            return(null);
        }
        public async Task CanGetReportForAllRuntimes()
        {
            var httpClient  = new ReleaseMetadataHttpClient();
            var allChannels = await httpClient.GetAllChannelsAsync();

            foreach (var channel in allChannels)
            {
                foreach (var release in channel.Releases)
                {
                    var releaseMetadataClient = new ReleaseMetadataClient();
                    var client = new ReportGenerator(releaseMetadataClient);
                    if (release.Runtime != null)
                    {
                        var report = await client.GetReport(AppRunTimeDetails.Build(release.Runtime.Version));

                        Assert.NotNull(report);
                    }
                }
            }
        }