Example #1
0
        public async void UpdateOrderAsync_ReturnCorrectUpdatesCount()
        {
            IEcwidOrdersClient client = new EcwidClient(_credentials)
            {
                Settings =
                {
                    ApiUrl = "http://www.mocky.io/v2/5967f962110000b9006149e5"
                }
            };

            var result = await client.UpdateOrderAsync(new OrderEntry { Email = "*****@*****.**", OrderNumber = 123 });

            Assert.Equal(1, result.UpdateCount);
        }
Example #2
0
        public async void UpdateOrderAsync_ReturnBadRequest()
        {
            IEcwidOrdersClient client = new EcwidClient(_credentials)
            {
                Settings =
                {
                    ApiUrl = "http://www.mocky.io/v2/5967f9f8110000b8006149e6"
                }
            };

            var exception = await Assert.ThrowsAsync <EcwidHttpException>(() =>
                                                                          client.UpdateOrderAsync(new OrderEntry {
                Email = "*****@*****.**", OrderNumber = 123
            }));

            Assert.Equal(HttpStatusCode.BadRequest, exception.StatusCode);
        }
        public async void UpdateOrderAsyncFail()
        {
            IEcwidOrdersClient client = new EcwidClient(_credentials)
            {
                Settings =
                {
                    ApiUrl = "http://www.mocky.io/v2/5967f9f8110000b8006149e6"
                }
            };

            var exception = await Assert.ThrowsAsync <EcwidHttpException>(() => client.UpdateOrderAsync(new OrderEntry {
                Email = "*****@*****.**", OrderNumber = 123
            }));

            Assert.Equal(HttpStatusCode.BadRequest, exception.StatusCode);
            Assert.Equal("Status QUEUED is deprecated, use AWAITING_PAYMENT instead", exception.Message);
        }