public async void GetProfileAsync() { IEcwidProfileClient client = new EcwidClient(_credentials) { Settings = { ApiUrl = "http://www.mocky.io/v2/572a0c0a0f0000bf0ea0557c" //response with profile from ecwid. } }; var result = await client.GetProfileAsync(); Assert.NotNull(result); }
public async void GetProfileRealAsync() { IEcwidProfileClient client = new EcwidClient(_credentials) { Settings = { ApiUrl = "http://www.mocky.io/v2/572a0e360f00001e0fa05580" //response with profile from real world. } }; var result = await client.GetProfileAsync(); Assert.NotNull(result); }
public async void GetOrdersCountAsync() { IEcwidOrdersClient client = new EcwidClient(_credentials) { Settings = { ApiUrl = "http://www.mocky.io/v2/5720a20b0f0000f108387258" //set with count=1, limit=1 and total } }; var result = await client.GetOrdersCountAsync(); Assert.Equal(1021, result); }
public async void CheckOrdersTokenAsync() { IEcwidOrdersClient client = new EcwidClient(_credentials) { Settings = { ApiUrl = "http://www.mocky.io/v2/57209e300f0000f208387249" //response with one order and limit = 1. } }; var result = await client.CheckOrdersTokenAsync(); Assert.Equal(true, result); }
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); }
public async void CheckOrdersAuthAsyncFail() { IEcwidOrdersClient client = new EcwidClient(_credentials) { Settings = { ApiUrl = "http://www.mocky.io/v2/56fa70921100009b28a72180" //empty set with count, total and 403 code } }; var result = await client.CheckOrdersTokenAsync(); Assert.Equal(false, result); }
public async void GetOrderAsync() { //http://www.mocky.io/v2/57209cae0f0000a208387242 - one order IEcwidOrdersClient client = new EcwidClient(_credentials) { Settings = { ApiUrl = "http://www.mocky.io/v2/57209e580f0000f20838724a" //response with one order. } }; var result = await client.GetOrderAsync(18); Assert.Equal(18, result.OrderNumber); }
public async void ReadmeTest_ReturnCorrectList() { const int someShopId = 123; const string someToken = "4843094390fdskldgsfkldkljKLLKklfdkldsffds"; _httpTest .RespondWithJson(Mocks.MockSearchResultWithManyOrder()); var client = new EcwidClient(); var result = await client.Configure(someShopId, someToken).Orders .Limit(10) .CreatedFrom(DateTime.Today) .PaymentStatuses("PAID") .GetAsync(); Assert.Equal(10, result.Count()); }
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); }
public async void GetOrderAsync_ReturnCorrectNumbers() { //http://www.mocky.io/v2/57209cae0f0000a208387242 - one order IEcwidOrdersClient client = new EcwidClient(_credentials) { Settings = { // Mute by mutation testing FirstOrDefault // ApiUrl = "http://www.mocky.io/v2/57209e580f0000f20838724a" //response with one order. ApiUrl = "http://www.mocky.io/v2/5c83049d3000002b006b0bf3" //response with one order. } }; var result = await client.GetOrderAsync(18); Assert.Equal(18, result.OrderNumber); }