Пример #1
0
        public static void GetSimpleExample()
        {
            var dollarClient = new DollarClient();
            var euroClient   = new EuroClient();

            Console.WriteLine("Получаем значения из двух клиентов:");

            var dollarAmount = dollarClient.GetTotalAmount();
            var euroAmount   = euroClient.GetEuroSum();

            Console.WriteLine($"dollarClient.GetTotalAmount: {dollarAmount}");
            Console.WriteLine($"euroClient.GetEuroSum: {euroAmount}");

            Console.WriteLine($"Используем конвертеры для преобразования в рубли:");

            var dollarsInRubles = ConvertDollarsToRubles(dollarAmount);
            var euroInRubles    = ConvertEuroToRubles(euroAmount);

            Console.WriteLine($"ConvertDollarsToRubles(dollarAmount): {dollarsInRubles}");
            Console.WriteLine($"ConvertEuroToRubles(euroAmount): {euroInRubles}");

            Console.WriteLine($"Вызываем сервисный метод:");
            var rubleService = new RubleService();

            rubleService.ReceiveReportInRubles(dollarsInRubles);
            rubleService.ReceiveReportInRubles(euroInRubles);
        }
Пример #2
0
 public MoneyAdapter()
 {
     _dollarClient = new DollarClient();
     _euroClient   = new EuroClient();
 }