public async void ShouldNotBeAbleToCreatePoWhenNotRegisteredCaller()
        {
            // Try to create a PO sent by a non-authorised user, it should fail
            // Prepare a new PO
            Purchasing.Po poAsRequested = await CreatePurchasingPoAsync(quoteId : GetRandomInt(), eShopId : GetRandomString());

            var signature = poAsRequested.ToBuyerPo().GetSignatureBytes(_contracts.Web3);

            // Request creation of new PO using preexisting Purchasing contract, but with tx executed by the non-authorised ("secondary") user
            await Task.Delay(1);

            var         ps  = new PurchasingService(_contracts.Web3SecondaryUser, _contracts.Deployment.PurchasingService.ContractHandler.ContractAddress);
            Func <Task> act = async() => await ps.CreatePurchaseOrderRequestAndWaitForReceiptAsync(poAsRequested, signature);

            act.Should().Throw <SmartContractRevertException>().WithMessage(AUTH_EXCEPTION_ONLY_REGISTERED);
        }
Exemplo n.º 2
0
 // Buyer <=> Purchasing
 public static Buyer.Po ToBuyerPo(this Purchase.Po po)
 {
     return(_mapper.Map <Buyer.Po>(po));
 }
Exemplo n.º 3
0
 // PoStorage <=> Purchasing
 public static Storage.Po ToStoragePo(this Purchase.Po po)
 {
     return(_mapper.Map <Storage.Po>(po));
 }