public GetShopListings ( int userId, SortField sortOn, SortOrder sortOrder, int sectionId, int offset, int limit, DetailLevel detailLevel ) : IAsyncResult | ||
userId | int | the user id |
sortOn | SortField | field to sort on |
sortOrder | SortOrder | sort ascending or descending |
sectionId | int | shop section to show |
offset | int | the search results offset |
limit | int | the search limit |
detailLevel | DetailLevel | the level of detail |
return | IAsyncResult |
public void GetShopListingsByIdApiKeyInvalidTest() { // ARRANGE using (AutoResetEvent waitEvent = new AutoResetEvent(false)) { ResultEventArgs<Listings> result = null; IShopService shopsService = new ShopService(new EtsyContext("InvalidKey")); shopsService.GetShopListingsCompleted += (s, e) => { result = e; waitEvent.Set(); }; // ACT shopsService.GetShopListings(NetsyData.TestUserId, SortField.Created, SortOrder.Up, 0, 0, 10, DetailLevel.Low); bool signalled = waitEvent.WaitOne(NetsyData.WaitTimeout); // ASSERT // check that the event was fired, did not time out Assert.IsTrue(signalled, "Not signalled"); // check the data - should fail Assert.IsNotNull(result); Assert.IsNotNull(result.ResultStatus); Assert.IsFalse(result.ResultStatus.Success); Assert.AreEqual(WebExceptionStatus.ProtocolError, result.ResultStatus.WebStatus); } }
public void GetShopListingsByIdMissingApiKeyTest() { // ARRANGE ResultEventArgs<Listings> result = null; IShopService shopsService = new ShopService(new EtsyContext(string.Empty)); shopsService.GetShopListingsCompleted += (s, e) => result = e; // ACT shopsService.GetShopListings(NetsyData.TestUserId, SortField.Created, SortOrder.Up, 0, 0, 10, DetailLevel.Low); // check the data TestHelpers.CheckResultFailure(result); }
public void GetShopListingsByIdRetrieveLowDetailTest() { // ARANGE using (AutoResetEvent waitEvent = new AutoResetEvent(false)) { ResultEventArgs<Listings> result = null; IShopService shopsService = new ShopService(new EtsyContext(NetsyData.EtsyApiKey)); shopsService.GetShopListingsCompleted += (s, e) => { result = e; waitEvent.Set(); }; // ACT shopsService.GetShopListings(NetsyData.TestUserId, SortField.Created, SortOrder.Down, 0, 0, 10, DetailLevel.Low); bool signalled = waitEvent.WaitOne(NetsyData.WaitTimeout); // ASSERT // check that the event was fired, did not time out Assert.IsTrue(signalled, "Not signalled"); // check the data TestHelpers.CheckResultSuccess(result); Assert.IsNotNull(result.ResultValue.Results); Assert.IsTrue(result.ResultStatus.Success); Assert.IsTrue(result.ResultValue.Count > 0); } }