コード例 #1
0
 public void Dispose()
 {
     if (GetCustomerCashPurseRequest != null)
     {
         GetCustomerCashPurseRequest.GetInvocationList().ToList().ForEach(x => GetCustomerCashPurseRequest -= (RequestEventHandler <ICustomerPurse>)x);
     }
     if (GetVendingMachineChangeRequest != null)
     {
         GetVendingMachineChangeRequest.GetInvocationList().ToList().ForEach(x => GetVendingMachineChangeRequest -= (RequestEventHandler <IVendingMachineChange>)x);
     }
     if (GetGoodsRequest != null)
     {
         GetGoodsRequest.GetInvocationList().ToList().ForEach(x => GetGoodsRequest -= (RequestEventHandler <IGoods>)x);
     }
     if (RefreshPutCoinBoxRequest != null)
     {
         RefreshPutCoinBoxRequest.GetInvocationList().ToList().ForEach(x => RefreshPutCoinBoxRequest -= (VoidEventHandler)x);
     }
     if (RefreshTemplatesRequest != null)
     {
         RefreshTemplatesRequest.GetInvocationList().ToList().ForEach(x => RefreshTemplatesRequest -= (VoidEventHandler <AccountType, CoinType>)x);
     }
     if (DisposeRequest != null)
     {
         DisposeRequest();
         DisposeRequest.GetInvocationList().ToList().ForEach(x => DisposeRequest -= (VoidEventHandler)x);
     }
 }
コード例 #2
0
        public void TestGetGoods2()
        {
            // 接口请求
            GetGoodsRequest request = new GetGoodsRequest();
            // 请求参数
            GoodsParam param = new GoodsParam();

            // 属性赋值
            param.goods_name = "iphone6";

            // 设置请求参数
            request.Param = param;
            // GET请求
            request.RequestMethod = RequestMethod.GET;

            // 发送请求,返回结果
            GetGoodsResponse response = client.Execute <GetGoodsResponse>(request);

            if (response.IsSuccess())
            {
                Assert.IsTrue(response.data is Goods);
                Assert.IsTrue(response.data.goods_name == "苹果iPhoneX");
            }
            else
            {
                throw new SystemException(response.msg);
            }
        }
コード例 #3
0
        public void TestGetGoodsJwt()
        {
            // 接口请求
            GetGoodsRequest request = new GetGoodsRequest();
            // 请求参数
            GoodsParam param = new GoodsParam();

            // 属性赋值
            param.goods_name = "iphone6";

            // 设置请求参数
            request.Param = param;

            OpenHttp openHttp = new OpenHttp(new OpenConfig());
            string   jwt      = openHttp.Get(@"http://localhost:8080/jwtLogin", null);

            // 发送请求,返回结果
            GetGoodsResponse response = client.Execute <GetGoodsResponse>(request, jwt);

            if (response.IsSuccess())
            {
                Assert.IsTrue(response.data is Goods);
                Assert.IsTrue(response.data.goods_name == "苹果iPhoneX");
            }
            else
            {
                throw new SystemException(response.msg);
            }
        }
コード例 #4
0
ファイル: GoodsController.cs プロジェクト: Coocoo1984/EFnew
        //获取商品信息
        public async Task <IActionResult> Get(int id)
        {
            var request = new GetGoodsRequest()
            {
                ID = id
            };

            try
            {
                var response = await _serviceProvider.HandlerAsync(request);

                return(new JsonResult(response));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new ResponseBase()
                {
                    Result = -1, ResultInfo = ex.Message
                }));
            }
        }
コード例 #5
0
 protected IGoods GetGoods()
 {
     return(GetGoodsRequest?.Invoke());
 }