public async Task ExecuteAsync_throws_ArgumentException_if_request_wrong_Type()
        {
            const double updatedBalance = 1.23;
            var          sale           = new Sale(saleID: 5)
            {
                Balance = 0
            };
            var sut = new FunctionActionParameterized <Sale, Sale>((sale1, sale2, _) => Task.FromResult(sale1.Balance = updatedBalance));

            await Assert.ThrowsAsync <ArgumentException>(() => sut.ExecuteAsync(sale, request: "wrongType", cancellationToken: default(CancellationToken)));
        }
        public async Task ExecuteAsync_executes_Action()
        {
            const double updatedBalance = 1.23;
            var          sale           = new Sale(saleID: 5)
            {
                Balance = 0
            };
            var sut = new FunctionActionParameterized <Sale, Sale>((sale1, sale2, _) => Task.FromResult(sale1.Balance = updatedBalance));

            await sut.ExecuteAsync(sale, request : sale, cancellationToken : default(CancellationToken));

            Assert.Equal(updatedBalance, sale.Balance);
        }
        public void ExecuteAsync_can_be_cancelled()
        {
            using var cancellationSource = new CancellationTokenSource();
            var sale = new Sale(saleId: 3);

            var sut = new FunctionActionParameterized <Sale, Sale>((_, sale2, cancelToken) =>
                                                                   Task.Delay(millisecondsDelay: 999999, cancellationToken: cancelToken));

            var funcTask = Task.Run(async() => await sut.ExecuteAsync(sale, cancellationSource.Token, request: sale), cancellationSource.Token);

            cancellationSource.Cancel();
            Task.Delay(millisecondsDelay: 67).Wait();

            Assert.True(funcTask.IsCanceled);
        }