Пример #1
0
        public void TestUpdateAuthorization()
        {
            // Arrange
            UpdateAuthorization updateAuthorization = new UpdateAuthorization()
            {
                Description = "TestUpdateAuthorization description"
            };

            this.requestMock.Expect(x => x.CreateRequest(this.baseUrl.ToString().TrimEnd('/') + this.path + '/' + this.orderId + "/authorization")).Return(this.httpWebRequest);

            WebHeaderCollection headers = new WebHeaderCollection();

            headers["Location"] = this.location;

            IResponse response = new Response(HttpStatusCode.NoContent, headers, string.Empty);

            this.requestMock.Expect(x => x.Send(this.httpWebRequest, updateAuthorization.ConvertToJson())).Return(response);

            // Act
            this.order.UpdateAuthorization(updateAuthorization);

            // Assert
            this.requestMock.VerifyAllExpectations();
            Assert.AreEqual(this.httpWebRequest.ContentLength, updateAuthorization.ConvertToJson().Length);
            TestsHelper.AssertRequest(this.merchantId, this.secret, this.httpWebRequest, HttpMethod.Patch);
        }
Пример #2
0
        public void OrderManagement_Order_UpdateAuthorization_Basic()
        {
            // Arrange
            UpdateAuthorization updateAuthorization = TestsHelper.GetUpdateAuthorization();

            TestsHelper.Mock(HttpMethod.Patch, this.order.Location + "/authorization", updateAuthorization.ConvertToJson(), HttpStatusCode.NoContent, this.connectorMock);

            this.order.UpdateAuthorization(updateAuthorization);
        }