コード例 #1
0
        public async Task GetSavingsPlan_RegionIndex_ECS()
        {
            // ARRANGE
            PriceListClient          client       = new PriceListClient();
            GetOfferIndexFileRequest indexRequest = new GetOfferIndexFileRequest();

            GetOfferIndexFileResponse indexResponse = await client.GetOfferIndexFileAsync(indexRequest);

            GetSavingsPlanIndexFileRequest spRegionIndexRequest = new GetSavingsPlanIndexFileRequest(indexResponse.OfferIndexFile.Offers["AmazonECS"].CurrentSavingsPlanIndexUrl);

            // ACT
            GetSavingsPlanIndexFileResponse spRegionIndexResponse = await client.GetSavingsPlanRegionIndexAsync(spRegionIndexRequest);

            // ASSERT
            Assert.Equal(200, (int)spRegionIndexResponse.HttpStatusCode);
        }
コード例 #2
0
        public async Task GetSavingsPlan_Offer_UsEast1_EC2()
        {
            // ARRANGE
            PriceListClient          client       = new PriceListClient();
            GetOfferIndexFileRequest indexRequest = new GetOfferIndexFileRequest();

            GetOfferIndexFileResponse indexResponse = await client.GetOfferIndexFileAsync(indexRequest);

            GetSavingsPlanIndexFileRequest  spRegionIndexRequest  = new GetSavingsPlanIndexFileRequest(indexResponse.OfferIndexFile.Offers["AmazonEC2"].CurrentSavingsPlanIndexUrl);
            GetSavingsPlanIndexFileResponse spRegionIndexResponse = await client.GetSavingsPlanRegionIndexAsync(spRegionIndexRequest);

            GetSavingsPlanRequest spRequest = new GetSavingsPlanRequest(spRegionIndexResponse.RegionIndex.Regions.First(x => x.RegionCode.Equals("us-east-1")).VersionUrl);

            // ACT
            GetSavingsPlanResponse spResponse = await client.GetSavingsPlanAsync(spRequest);

            // ASSERT
            Assert.Equal(200, (int)spResponse.HttpStatusCode);
            Assert.NotNull(spResponse.SavingsPlan.Products);
            Assert.True(spResponse.SavingsPlan.Products.Any());
            Assert.NotNull(spResponse.SavingsPlan.Terms);
            Assert.NotNull(spResponse.SavingsPlan.Terms.SavingsPlan);
            Assert.True(spResponse.SavingsPlan.Terms.SavingsPlan.Any());
        }