public void GetFrontFeaturedListingsTest() { EtsyContext etsyContext = new EtsyContext(Constants.DummyEtsyApiKey); MockFixedDataRequestGenerator requestGenerator = new MockFixedDataRequestGenerator(GetFrontFeaturedListingsRawResults); DataRetriever dataRetriever = new DataRetriever(new NullDataCache(), requestGenerator); IListingsService etsyListingsService = new ListingsService(etsyContext, dataRetriever); using (AutoResetEvent waitEvent = new AutoResetEvent(false)) { ResultEventArgs<Listings> result = null; etsyListingsService.GetFrontFeaturedListingsCompleted += (s, e) => { result = e; waitEvent.Set(); }; // ACT etsyListingsService.GetFrontFeaturedListings(0, 10, DetailLevel.Low); bool signalled = waitEvent.WaitOne(Constants.WaitTimeout); // ASSERT // check that the event was fired, did not time out Assert.IsTrue(signalled, "Not signalled"); TestHelpers.CheckResultSuccess(result); } }
public void GetTopCategoriesTest() { EtsyContext etsyContext = new EtsyContext(Constants.DummyEtsyApiKey); MockFixedDataRequestGenerator requestGenerator = new MockFixedDataRequestGenerator(GetTopCategoriesRawResults); DataRetriever dataRetriever = new DataRetriever(new NullDataCache(), requestGenerator); ITagCategoryService etsyTagCategoryService = new TagCategoryService(etsyContext, dataRetriever); using (AutoResetEvent waitEvent = new AutoResetEvent(false)) { ResultEventArgs<StringResults> result = null; etsyTagCategoryService.GetTopCategoriesCompleted += (s, e) => { result = e; waitEvent.Set(); }; // ACT etsyTagCategoryService.GetTopCategories(); bool signalled = waitEvent.WaitOne(Constants.WaitTimeout); // ASSERT // check that the event was fired, did not time out Assert.IsTrue(signalled, "Not signalled"); // check the data TestHelpers.CheckResultSuccess(result); } }
/// <summary> /// Start the Uri with the base uri /// </summary> /// <param name="etsyContext">the etsy context</param> /// <returns>the Uri builder</returns> public static UriBuilder Start(EtsyContext etsyContext) { UriBuilder instance = new UriBuilder(etsyContext); instance.Append(etsyContext.BaseUrl); return instance; }
/// <summary> /// Start the Uri with the base uri and a path under that /// </summary> /// <param name="etsyContext">the etsy context</param> /// <param name="basePath">the path on the base uri</param> /// <returns>the Uri builder</returns> public static EtsyUriBuilder Start(EtsyContext etsyContext, string basePath) { EtsyUriBuilder instance = new EtsyUriBuilder(etsyContext); instance.Append(etsyContext.BaseUrl); instance.Append(basePath); return instance; }
public void CreateWithMockRequestTest() { EtsyContext etsyContext = new EtsyContext(string.Empty); IRequestGenerator requestGenerator = new MockFixedDataRequestGenerator(string.Empty); DataRetriever dataRetriever = new DataRetriever(new NullDataCache(), requestGenerator); IListingsService service = new ListingsService(etsyContext, dataRetriever); Assert.IsNotNull(service); }
/// <summary> /// Initializes a new instance of the GiftService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public GiftService(EtsyContext etsyContext) { this.etsyContext = etsyContext; }
/// <summary> /// Initializes a new instance of the TagCategoryService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public TagCategoryService(EtsyContext etsyContext) { this.etsyContext = etsyContext; }
/// <summary> /// Initializes a new instance of the FeedbackService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public FeedbackService(EtsyContext etsyContext) : this(etsyContext, new DataRetriever()) { }
/// <summary> /// Initializes a new instance of the FavoritesService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public FavoritesService(EtsyContext etsyContext) { this.etsyContext = etsyContext; }
/// <summary> /// Initializes a new instance of the ShopService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public ShopService(EtsyContext etsyContext) { this.etsyContext = etsyContext; }
/// <summary> /// Initializes a new instance of the ListingsService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public ListingsService(EtsyContext etsyContext) { this.etsyContext = etsyContext; }
/// <summary> /// Initializes a new instance of the FeedbackService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public FeedbackService(EtsyContext etsyContext) { this.etsyContext = etsyContext; }
/// <summary> /// Initializes a new instance of the ShopService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public ShopService(EtsyContext etsyContext) : this(etsyContext, new DataRetriever()) { }
/// <summary> /// Start the Uri with the base uri and a path under that /// </summary> /// <param name="etsyContext">the etsy context</param> /// <param name="basePath">the path on the base uri</param> /// <param name="id">the item id to append</param> /// <returns>the Uri builder</returns> public static UriBuilder Start(EtsyContext etsyContext, string basePath, int id) { return Start(etsyContext, basePath, id.ToString(CultureInfo.InvariantCulture)); }
/// <summary> /// Initializes a new instance of the UriBuilder class /// </summary> /// <param name="etsyContext">the etsy context to use</param> private UriBuilder(EtsyContext etsyContext) { this.etsyContext = etsyContext; }
/// <summary> /// Start the Uri with the base uri and a path under that /// </summary> /// <param name="etsyContext">the etsy context</param> /// <param name="basePath">the path on the base uri</param> /// <param name="color">the color to append</param> /// <returns>the Uri builder</returns> public static UriBuilder Start(EtsyContext etsyContext, string basePath, EtsyColor color) { if (color == null) { return Start(etsyContext, basePath); } return Start(etsyContext, basePath, color.ToString()); }
/// <summary> /// Start the Uri with the base uri and a path under that /// </summary> /// <param name="etsyContext">the etsy context</param> /// <param name="basePath">the path on the base uri</param> /// <param name="id">the item id to append</param> /// <returns>the Uri builder</returns> public static UriBuilder Start(EtsyContext etsyContext, string basePath, string id) { UriBuilder instance = new UriBuilder(etsyContext); instance.Append(etsyContext.BaseUrl); instance.Append(basePath); instance.Append("/"); instance.Append(id); return instance; }
/// <summary> /// Initializes a new instance of the ServerService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public ServerService(EtsyContext etsyContext) { this.etsyContext = etsyContext; }
/// <summary> /// Initializes a new instance of the ShopService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> /// <param name="dataRetriever">the data retreiver to use</param> public ShopService(EtsyContext etsyContext, IDataRetriever dataRetriever) { this.etsyContext = etsyContext; this.dataRetriever = dataRetriever; }
/// <summary> /// Initializes a new instance of the UsersService class /// </summary> /// <param name="etsyContext">the etsy context to use</param> public UsersService(EtsyContext etsyContext) { this.etsyContext = etsyContext; }