예제 #1
0
        public static void Main(String[] arg)
        {
            var bankomate = new Bancomat();

            Console.WriteLine(bankomate.CashOut(6507, CurrencyType.Ruble));
            Console.WriteLine(bankomate.CashOut(6507, CurrencyType.Dollar));
        }
예제 #2
0
        public void Method()
        {
            var rublesBancomat = new Bancomat(RublesHandlersFactory.Create());
            var result         = rublesBancomat.WithdrawMoney(2050);

            Console.WriteLine($"{result.Value} : {result.Currency}");

            try
            {
                var dollarsBancomat = new Bancomat(DollarsHandlersFactory.Create());
                var _ = dollarsBancomat.WithdrawMoney(2033);
            }
            catch (InvalidOperationException e)
            {
                Console.WriteLine(e.Message);
            }
        }