Ejemplo n.º 1
0
        public async Task <InventoryStatusResponse> ReviseInventoryStatusAsync(InventoryStatusRequest inventoryStatusReq, InventoryStatusRequest inventoryStatusReq2 = null, InventoryStatusRequest inventoryStatusReq3 = null, InventoryStatusRequest inventoryStatusReq4 = null, string mark = "")
        {
            var headers = CreateReviseInventoryStatusHeadersWithApiCallName();

            var body = this.CreateReviseInventoryStatusRequestBody(inventoryStatusReq, inventoryStatusReq2, inventoryStatusReq3, inventoryStatusReq4);

            var request = await this.CreateEbayStandartPostRequestWithCertAsync(this._endPoint, headers, body, mark, CancellationToken.None).ConfigureAwait(false);

            using (var memStream = await this._webRequestServices.GetResponseStreamAsync(request, mark, CancellationToken.None).ConfigureAwait(false))
            {
                var inventoryStatusResponse =
                    new EbayReviseInventoryStatusResponseParser().Parse(memStream);
                inventoryStatusResponse.RequestedItems = new List <InventoryStatusRequest>()
                {
                    inventoryStatusReq, inventoryStatusReq2, inventoryStatusReq3, inventoryStatusReq4
                }.Where(x => x != null).ConvertTo <InventoryStatusRequest, Models.ReviseInventoryStatusResponse.Item>().ToList();
                return(inventoryStatusResponse);
            }
        }
        public void CorrectReviseInventoryStatusResponseWithInventory_ParseInventoryStatusResponse_HookupCorrectDeserializedObject()
        {
            //A
            using (var fs = new FileStream(@".\Files\ReviseInventoryStatusResponse.xml", FileMode.Open, FileAccess.Read))
            {
                //A
                var inventoryStatus = new EbayReviseInventoryStatusResponseParser().Parse(fs);

                //A
                inventoryStatus.ShouldBeEquivalentTo(new InventoryStatusResponse
                {
                    Items = new List <Item>
                    {
                        new Item
                        {
                            ItemId     = 110136942332,
                            StartPrice = 1.0,
                            Quantity   = 101,
                            Sku        = string.Empty
                        }
                    }
                });
            }
        }