Ejemplo n.º 1
0
        protected async override void OnActivated(IActivatedEventArgs args)
        {
            if (args.Kind == ActivationKind.Protocol)
            {
                ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;

                await ActivateHandler.HandleUriLaunch(eventArgs.Uri.AbsoluteUri);
            }
        }
Ejemplo n.º 2
0
        async Task <Result <OrderActivated> > Run(SetupData data)
        {
            var order = new Order
            {
                Id                 = 1,
                ItemId             = 1,
                LendingUnitId      = 2,
                RequestingMemberId = 1,
                RequestingUnitId   = 3,
                Status             = data.StartingStatus
            };

            var unitId = data.MemberSide == OrderSide.Lending ? order.LendingUnitId : order.RequestingUnitId;
            var member = new Member(2, unitId, data.MemberPermissions);
            var item   = new Item
            {
                Id    = 1,
                Price = 100
            };
            var orderingService = new Mock <IOrderingService>();

            orderingService.Setup(a => a.GetOrder(1)).ReturnsAsync(order);
            orderingService.Setup(a => a.GetMemberById(2)).ReturnsAsync(member);
            orderingService.Setup(a => a.UpdateOrder(It.IsAny <Order>()))
            .ReturnsAsync(new BaseGatewayResponse(true));
            orderingService.Setup(a => a.Update(It.IsAny <UnitItem>()))
            .ReturnsAsync(new BaseGatewayResponse(true));
            orderingService.Setup(a => a.GetItem(1)).ReturnsAsync(item);
            orderingService.Setup(a => a.GetUnitItem(It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(new UnitItem
            {
                UnitId = order.LendingUnitId,
                Amount = data.UnitItemAmount,
                ItemId = order.ItemId
            });
            orderingService.Setup(a => a.TransterMoney(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(new BaseGatewayResponse(true));
            var handler = new ActivateHandler(orderingService.Object);

            var request = new ActivateOrderRequest(1, 2);

            return(await handler.Handle(request));
        }
Ejemplo n.º 3
0
 private ArgumentOption(string key, OptionHandler handler, ActivateHandler activator)
 {
     this.key = key;
     this.handler = handler;
     this.activator = activator;
 }
Ejemplo n.º 4
0
 public ArgumentOption(string key, ActivateHandler activator)
     : this(key, null, activator)
 {
 }
Ejemplo n.º 5
0
 private ArgumentOption(string key, OptionHandler handler, ActivateHandler activator)
 {
     this.key       = key;
     this.handler   = handler;
     this.activator = activator;
 }
Ejemplo n.º 6
0
 public ArgumentOption(string key, ActivateHandler activator)
     : this(key, null, activator)
 {
 }