GetUsersByName() public méthode

Query for users by name
public GetUsersByName ( string searchName, int offset, int limit, DetailLevel detailLevel ) : IAsyncResult
searchName string the name to search for
offset int the searh results offset
limit int the search limit
detailLevel DetailLevel the level of detail
Résultat IAsyncResult
        public void GetUsersByNameApiKeyInvalidTest()
        {
            // ARRANGE
            using (AutoResetEvent waitEvent = new AutoResetEvent(false))
            {
                ResultEventArgs<Users> result = null;
                IUsersService etsyUsers = new UsersService(new EtsyContext("InvalidKey"));
                etsyUsers.GetUsersByNameCompleted += (s, e) =>
                {
                    result = e;
                    waitEvent.Set();
                };

                // ACT
                // the etsy server should have data here - at least 3 shops with "fred" in the name
                etsyUsers.GetUsersByName("Fred", 0, 3, DetailLevel.Low);
                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 - should fail
                Assert.IsNotNull(result);
                Assert.IsNotNull(result.ResultStatus);
                Assert.IsFalse(result.ResultStatus.Success);
                Assert.AreEqual(WebExceptionStatus.ProtocolError, result.ResultStatus.WebStatus);
            }
        }
        public void GetUsersByNameLowDetailRetrievalTest()
        {
            // ARRANGE
            using (AutoResetEvent waitEvent = new AutoResetEvent(false))
            {
                ResultEventArgs<Users> result = null;
                IUsersService etsyUsers = new UsersService(new EtsyContext(NetsyData.EtsyApiKey));
                etsyUsers.GetUsersByNameCompleted += (s, e) =>
                {
                    result = e;
                    waitEvent.Set();
                };

                // ACT
                // the etsy server should have data here - at least 3 shops with "fred" in the name
                etsyUsers.GetUsersByName("Fred", 0, 3, DetailLevel.Low);
                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);

                Assert.IsNotNull(result.ResultValue.Params);
                Assert.IsNotNull(result.ResultValue.Results);

                // the etsy server should have at least 3 shops with "fred" in the name
                Assert.IsTrue(result.ResultValue.Count >= 3);
            }
        }