示例#1
0
        public async Task TestGetVersionIndexFile_AllServices()
        {
            // ARRANGE
            PriceListClient           client   = new PriceListClient();
            GetOfferIndexFileResponse response = await client.GetOfferIndexFileAsync();

            ConcurrentBag <VersionIndex> indices = new ConcurrentBag <VersionIndex>();

            // ACT
            IEnumerable <Task> tasks = response.OfferIndexFile.Offers.Select(async x =>
            {
                GetVersionIndexResponse versionIndexResponse = await client.GetVersionIndexAsync(new GetVersionIndexRequest(x.Value));

                if (versionIndexResponse != null && versionIndexResponse.VersionIndex != null)
                {
                    indices.Add(versionIndexResponse.VersionIndex);
                }
            });

            await Task.WhenAll(tasks);

            // ASSERT
            Assert.Equal(response.OfferIndexFile.Offers.Where(x => !String.IsNullOrEmpty(x.Value.VersionIndexUrl)).Count(), indices.Count);
            Assert.All(indices, x => Assert.NotNull(x));
        }
示例#2
0
        public async Task TestGetVerionIndexFile_AmazonEC2_WithOffer()
        {
            // ARRANGE
            PriceListClient           client   = new PriceListClient();
            GetOfferIndexFileResponse response = await client.GetOfferIndexFileAsync();

            Offer offer = response.OfferIndexFile.Offers["AmazonEC2"];

            // ACT
            GetVersionIndexResponse versionResponse = await client.GetVersionIndexAsync(new GetVersionIndexRequest(offer));

            // ASSERT
            Assert.Equal(200, (int)versionResponse.HttpStatusCode);
        }
示例#3
0
        public async Task TestGetVerionIndexFile_AmazonEC2_WithRelativePath()
        {
            // ARRANGE
            PriceListClient           client   = new PriceListClient();
            GetOfferIndexFileResponse response = await client.GetOfferIndexFileAsync();

            string versionIndexUrl = response.OfferIndexFile.Offers["AmazonEC2"].VersionIndexUrl;

            // ACT
            GetVersionIndexResponse versionResponse = await client.GetVersionIndexAsync(new GetVersionIndexRequest(versionIndexUrl));

            // ASSERT
            Assert.Equal(200, (int)versionResponse.HttpStatusCode);
        }