public void BuyProduct_ShouldReturn_CoinChanges(
            decimal deposit,
            string productName,
            decimal expectedReturnVal,
            int expectedOneEuroCoinAmount,
            int expectedFiftyCentCoinAmount,
            int expectedTwentyCentCoinAmount,
            int expectedTenCentCoinAmount
            )
        {
            // arrange
            _vendingMachineService.InsertCoinsFromTestInput(deposit.ToWalletDto());

            // action
            var result = _vendingMachineService.BuyProductAsync(productName).Result;

            // assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Wallet, Is.Not.Null);
            Assert.That(result.Wallet.TotalValue, Is.EqualTo(expectedReturnVal));
            Assert.That(result.Wallet.OneEuroCoinAmount, Is.EqualTo(expectedOneEuroCoinAmount));
            Assert.That(result.Wallet.FiftyCentCoinAmount, Is.EqualTo(expectedFiftyCentCoinAmount));
            Assert.That(result.Wallet.TwentyCentCoinAmount, Is.EqualTo(expectedTwentyCentCoinAmount));
            Assert.That(result.Wallet.TenCentCoinAmount, Is.EqualTo(expectedTenCentCoinAmount));
        }
        public void BuyProduct_SomeCoinsAreEmpty_ShouldReturn_OtherCoinChanges(
            decimal deposit,
            string productName,
            decimal expectedReturnVal,
            int initialOneEuroAmount,
            int initialFiftyCentAmount,
            int initialTwentyCentAmount,
            int initialTenCentAmount,
            int expectedOneEuroCoinAmount,
            int expectedFiftyCentCoinAmount,
            int expectedTwentyCentCoinAmount,
            int expectedTenCentCoinAmount
            )
        {
            // arrange
            _walletFactory = new WalletFactory(
                initialOneEuroAmount,
                initialFiftyCentAmount,
                initialTwentyCentAmount,
                initialTenCentAmount
                );

            _vendingMachineService = new VendingMachineService(_walletFactory);

            _vendingMachineService.InsertCoinsFromTestInput(deposit.ToWalletDto());

            // action
            var result = _vendingMachineService.BuyProductAsync(productName).Result;

            // assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.IsSuccess, Is.True);
            Assert.That(result.Wallet, Is.Not.Null);
            Assert.That(result.Wallet.TotalValue, Is.EqualTo(expectedReturnVal));
            Assert.That(result.Wallet.OneEuroCoinAmount, Is.EqualTo(expectedOneEuroCoinAmount));
            Assert.That(result.Wallet.FiftyCentCoinAmount, Is.EqualTo(expectedFiftyCentCoinAmount));
            Assert.That(result.Wallet.TwentyCentCoinAmount, Is.EqualTo(expectedTwentyCentCoinAmount));
            Assert.That(result.Wallet.TenCentCoinAmount, Is.EqualTo(expectedTenCentCoinAmount));
        }
        public void BuyProduct_NoCoinChangeAvailable_ShouldRevertOrder(
            decimal deposit,
            string productName,
            int initialOneEuroAmount,
            int initialFiftyCentAmount,
            int initialTwentyCentAmount,
            int initialTenCentAmount,
            int expectedOneEuroCoinAmount,
            int expectedFiftyCentCoinAmount,
            int expectedTwentyCentCoinAmount,
            int expectedTenCentCoinAmount)
        {
            // arrange
            _walletFactory = new WalletFactory(
                initialOneEuroAmount,
                initialFiftyCentAmount,
                initialTwentyCentAmount,
                initialTenCentAmount
                );

            _vendingMachineService = new VendingMachineService(_walletFactory);

            _vendingMachineService.InsertCoinsFromTestInput(deposit.ToWalletDto());

            // action
            var result = _vendingMachineService.BuyProductAsync(productName).Result;

            // assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.IsSuccess, Is.False);
            Assert.That(result.Message, Is.EqualTo("Order is cancelled. Sorry, there is no sufficient coin changes."));
            Assert.That(result.Wallet, Is.Not.Null);
            Assert.That(result.Wallet.TotalValue, Is.EqualTo(0));
            Assert.That(result.Wallet.OneEuroCoinAmount, Is.EqualTo(expectedOneEuroCoinAmount));
            Assert.That(result.Wallet.FiftyCentCoinAmount, Is.EqualTo(expectedFiftyCentCoinAmount));
            Assert.That(result.Wallet.TwentyCentCoinAmount, Is.EqualTo(expectedTwentyCentCoinAmount));
            Assert.That(result.Wallet.TenCentCoinAmount, Is.EqualTo(expectedTenCentCoinAmount));
        }