public double GetPriceByAsin(string asin) { var itemLookupByAsin = _awsProductApiClient.ItemLookupByAsin(asin); var sanOfferPrice = itemLookupByAsin.OfferPrice ?? 0.00; double sanitzedPrice = sanOfferPrice == 0.00 ? (itemLookupByAsin.ListPrice ?? 0) : sanOfferPrice; return(sanitzedPrice); }
public void ItemLookup_WithLargeResponse_RetrievesAFewPropertiesIWillSelectHaphazardly() { const string ISBN = "0131103628"; const double LIST_PRICE = 67; const string LARGE_IMAGE_URL = "http://ecx.images-amazon.com/images/I/41G0l2eBPNL.jpg"; WithItemLookupResponseLarge(); var item = api.ItemLookupByAsin(ASIN); Assert.IsNotNull(item); Assert.AreEqual <string>(ASIN, item.ASIN); Assert.AreEqual <string>(ISBN, item.ItemAttributes["ISBN"]); Assert.AreEqual <double>(LIST_PRICE, item.ListPrice.Value); Assert.AreEqual <string>(LARGE_IMAGE_URL, item.PrimaryImageSet[AwsImageType.LargeImage].URL); }
//------------------------------------------------------------------------------- /// <summary> /// Gather a single item /// </summary> /// <returns></returns> public AwsItem GatherItem(string itemId) { return(_apiClient.ItemLookupByAsin(itemId)); }