GetFeedbackAsBuyer() public method

Get a list of all feedback where the user was a buyer in the transaction.
public GetFeedbackAsBuyer ( int userId, int offset, int limit ) : IAsyncResult
userId int the user's numeric ID
offset int To page through large result sets, set offset to a multiple of limit
limit int Specify the number of results to return
return IAsyncResult
Ejemplo n.º 1
0
        public void GetFeedbackAsBuyerByNameApiKeyInvalidTest()
        {
            // ARRANGE
            using (AutoResetEvent waitEvent = new AutoResetEvent(false))
            {
                ResultEventArgs<Feedbacks> result = null;
                IFeedbackService feedbackService = new FeedbackService(new EtsyContext("InvalidKey"));
                feedbackService.GetFeedbackAsBuyerCompleted += (s, e) =>
                {
                    result = e;
                    waitEvent.Set();
                };

                // ACT
                feedbackService.GetFeedbackAsBuyer(NetsyData.TestUserName, 0, 10);
                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);
            }
        }
Ejemplo n.º 2
0
        public void GetFeedbackAsBuyerByNameGetTest()
        {
            // ARRANGE
            using (AutoResetEvent waitEvent = new AutoResetEvent(false))
            {
                ResultEventArgs<Feedbacks> result = null;
                IFeedbackService feedbackService = new FeedbackService(new EtsyContext(NetsyData.EtsyApiKey));
                feedbackService.GetFeedbackAsBuyerCompleted += (s, e) =>
                {
                    result = e;
                    waitEvent.Set();
                };

                // ACT
                feedbackService.GetFeedbackAsBuyer(NetsyData.TestUserName, 0, 10);
                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 suceed
                TestHelpers.CheckResultSuccess(result);
            }
        }
Ejemplo n.º 3
0
        public void GetFeedbackAsBuyerMissingApiKeyTest()
        {
            // ARRANGE
            ResultEventArgs<Feedbacks> result = null;
            IFeedbackService feedbackService = new FeedbackService(new EtsyContext(string.Empty));
            feedbackService.GetFeedbackAsBuyerCompleted += (s, e) => result = e;

            // ACT
            feedbackService.GetFeedbackAsBuyer(NetsyData.TestUserId, 0, 10);

            // check the data
            TestHelpers.CheckResultFailure(result);
        }