public async Task CheckCompleteOrderTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.CheckCompleteOrderAsync(null, default));

            var result = await ApiInstance.CheckCompleteOrderAsync(DateTime.Now);

            Assert.NotNull(result);
        }
Example #2
0
        public async Task CheckAreaTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.CheckAreaAsync(null, 0, 0, 0, 0));

            var jdAddr = TestHelper.JDArress;
            var res    = await ApiInstance.CheckAreaAsync(jdAddr.ProvinceId, jdAddr.CityId, jdAddr.CountyId, jdAddr.TownId.Value);

            Assert.True(res.Success, res.ResultMessage);
            Assert.NotNull(res.Result);
            Assert.True(res.Result.Success);
        }
Example #3
0
        public async Task Oauth2RefreshATokenTest()
        {
            var res = await JdVopApi.Oauth2RefreshATokenAsync(TestHelper.VopClient, TestHelper.AccessToken.RefreshToken);

            Assert.True(res.Success, res.ResultMessage);
            var token = res.Result;

            Assert.NotNull(token);
            Assert.NotEmpty(token.AccessToken);
            TestHelper.AccessToken = token;
        }
        public async Task ProductCheckTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.ProductCheckAsync(null, default));

            var res = await ApiInstance.ProductCheckAsync(TestHelper.SkuNormal1);

            Assert.True(res.Success, res.ResultMessage);
            var result = res.Result;

            Assert.NotNull(result);
            Assert.NotEmpty(result);
        }
Example #5
0
        public async Task GetSellPriceTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetSellPriceAsync(null, null));

            var sku = $"{TestHelper.SkuNormal1},{TestHelper.SkuNormal2}";
            var res = await ApiInstance.GetSellPriceAsync(sku);

            Assert.True(res.Success, res.ResultMessage);
            var result = res.Result;

            Assert.NotNull(result);
            Assert.NotEmpty(result);
        }
Example #6
0
        public async Task GetTownTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetTownAsync(null, 0));

            var res = await ApiInstance.GetTownAsync(TestHelper.JDArress.CountyId);

            Assert.True(res.Success, res.ResultMessage);
            var town = res.Result;

            Assert.NotNull(town);
            Assert.NotEmpty(town);
            Assert.Contains(TestHelper.JDArress.Town, town.Keys);
        }
Example #7
0
        public async Task GetCountyTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetCountyAsync(null, 0));

            var res = await ApiInstance.GetCountyAsync(TestHelper.JDArress.CityId);

            Assert.True(res.Success, res.ResultMessage);
            var country = res.Result;

            Assert.NotNull(country);
            Assert.NotEmpty(country);
            Assert.Contains(TestHelper.JDArress.County, country.Keys);
        }
        public async Task SkuStateTestAsync()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.SkuStateAsync(null, default));

            var sku = TestHelper.SkuNormal1;
            var res = await ApiInstance.SkuStateAsync(sku);

            Assert.True(res.Success, res.ResultMessage);
            var skuState = res.Result;

            Assert.NotNull(skuState);
            Assert.NotEmpty(skuState);
            Assert.Equal(sku, skuState[0].SKU.ToString());
        }
        public async Task GetPageNumTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetPageNumAsync(null));

            var res = await ApiInstance.GetPageNumAsync();

            Assert.True(res.Success, res.ResultMessage);
            var pageNum = res.Result;

            Assert.NotNull(pageNum);
            Assert.NotEmpty(pageNum);
            Assert.DoesNotContain(pageNum, v => v.ContractSkuPoolExt != null);
            TestHelper.ProductPageNum = pageNum;
        }
        public async Task GetSkuByPageTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetSkuByPageAsync(null, default));

            var pageNum = TestHelper.ProductPageNum.Select(v => v.PageNum).First();
            var res     = await ApiInstance.GetSkuByPageAsync(pageNum, 1);

            Assert.True(res.Success, res.ResultMessage);
            var pnSku = res.Result;

            Assert.NotNull(pnSku);
            Assert.True(pnSku.PageCount > 0);
            Assert.NotEmpty(pnSku.SkuIds);
        }
        public async Task GetDetailTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetDetailAsync(null, default));

            var res = await ApiInstance.GetDetailAsync(TestHelper.SkuNormal1, "isSelf,isJDLogistics");

            Assert.True(res.Success, res.ResultMessage);
            var detail = res.Result;

            Assert.NotNull(detail);
            Assert.Equal(TestHelper.SkuNormal1BrandName, detail.BrandName);
            var keys = detail.ExtData.Keys;

            Assert.Contains("isSelf", keys);
            Assert.Contains("isJDLogistics", keys);
        }
Example #12
0
        public async Task GetProvinceTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetProvinceAsync(null));

            var res = await JdVopApi.Oauth2AccessTokenAsync(TestHelper.VopClient);

            var api = new JdVopApi(res.Result);
            var rsp = await api.GetProvinceAsync();


            //var res = await ApiInstance.GetProvinceAsync();
            //Assert.True(res.Success, res.ResultMessage);
            //var province = res.Result;
            //Assert.NotNull(province);
            //Assert.NotEmpty(province);
            //Assert.Contains(TestHelper.JDArress.Province, province.Keys);
        }
Example #13
0
        public async Task GetUnionBalanceTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetUnionBalanceAsync(null, null));

            var pin = TestHelper.VopClient.UserName;
            var res = await ApiInstance.GetUnionBalanceAsync(pin);

            Assert.True(res.Success, res.ResultMessage);
            var result = res.Result;

            Assert.NotNull(result);
            Assert.NotNull(result.Balance);
            Assert.Equal(result.Balance.Pin, pin);
            //测试帐号无金采权限时不返回geious内容
            //Assert.NotNull(result.Geious);
            //Assert.Equal(result.Geious.PIN, pin);
        }
        public async Task SkuImageTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.SkuImageAsync(null, default));

            var sku = TestHelper.SkuNormal1;
            var res = await ApiInstance.SkuImageAsync(sku);

            Assert.True(res.Success, res.ResultMessage);
            var skuImage = res.Result;

            Assert.NotNull(skuImage);
            Assert.Contains(sku, skuImage.Keys);
            var images = skuImage.GetValueOrDefault(sku);

            Assert.NotEmpty(images);
            Assert.Equal(1, images.Count(v => v.IsPrimary));
        }
Example #15
0
        public async Task GetBalanceDetailTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetBalanceDetailAsync(null));

            //测试账号采用对公转账模式,没有余额相关内容
            var res = await ApiInstance.GetBalanceDetailAsync();

            Assert.NotNull(res);
            var result = res.Result;

            Assert.NotNull(result);

            //使用测试JSON验证反序列化结果
            var demoJson = "{\"success\":true,\"resultMessage\":\"操作成功\",\"resultCode\":\"0000\",\"result\":{\"total\":281,\"pageSize\":20,\"pageNo\":1,\"pageCount\":15,\"data\":[{\"id\":2427064792,\"accountType\":1,\"amount\":-1,\"pin\":\"测试y\",\"orderId\":\"84567164608\",\"tradeType\":1209,\"tradeTypeName\":\"实物/礼品卡余额支付\",\"createdDate\":\"2019-01-04 12:44:58\",\"notePub\":\"订单:84567164608,消费余额:1\",\"tradeNo\":3429237517},{\"id\":2417527803,\"accountType\":1,\"amount\":1,\"pin\":\"测试y\",\"orderId\":\"84079230412\",\"tradeType\":758,\"tradeTypeName\":\"余额支付\",\"createdDate\":\"2018-12-27 14:07:06\",\"notePub\":\"订单84079230412退款为京东余额\",\"tradeNo\":3420482480}]}}";
            var demo     = JsonSerializer.Deserialize <RspResult <BalanceDetail> >(demoJson, JdVopApi.JsonSerializerOptions);

            result = demo.Result;
            Assert.NotNull(result);
            Assert.NotEmpty(result.Data);
        }
Example #16
0
        public async Task GetJDAddressFromAddressTest()
        {
            await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetJDAddressFromAddressAsync(null, default));

            var jdAddr = TestHelper.JDArress;
            var res    = await ApiInstance.GetJDAddressFromAddressAsync(TestHelper.JDAddressTest);

            Assert.True(res.Success, res.ResultMessage);
            var jdAddrRes = res.Result;

            Assert.NotNull(jdAddrRes);
            Assert.Equal("4744", jdAddrRes.NationId);
            Assert.Equal("中国", jdAddrRes.Nation);
            Assert.Equal(jdAddr.ProvinceId, jdAddrRes.ProvinceId);
            Assert.Equal(jdAddr.Province, jdAddrRes.Province);
            Assert.Equal(jdAddr.CityId, jdAddrRes.CityId);
            Assert.Equal(jdAddr.City, jdAddrRes.City);
            Assert.Equal(jdAddr.CountyId, jdAddrRes.CountyId);
            Assert.Equal(jdAddr.County, jdAddrRes.County);
            Assert.Equal(jdAddr.TownId, jdAddrRes.TownId);
            Assert.Equal(jdAddr.Town, jdAddrRes.Town);
        }
Example #17
0
 public async Task GetFreightTest()
 {
     await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetFreightAsync(null, default, default, 0, 0, 0, 0));
 public async Task CheckAreaLimitTest()
 {
     await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.CheckAreaLimitAsync(null, default, 0, 0, 0, 0));
Example #19
0
 public async Task GetNewStockByIdTest()
 {
     await Assert.ThrowsAsync <ArgumentException>(() => JdVopApi.GetNewStockByIdAsync(null, default, 0, 0, 0, 0));