Пример #1
0
 public CoffeeService(ICondimentServiceFactory condimentServiceFactory, IPaymentService paymentService, IApplicationSettingsService appSettings)
 {
     _condimentServiceFactory = condimentServiceFactory;
     _paymentService          = paymentService;
     _appSettings             = appSettings;
     _orders = new List <CoffeeOrder>();
 }
Пример #2
0
        static void Main(string[] args)
        {
            // Ideally this would be handled via an IOC container of some sort like autofac
            // in the interest of time I'm handling it manually here
            _appSettings             = new ApplicationSettingsService();
            _condimentServiceFactory = new CondimentServiceFactory(_appSettings);
            _paymentService          = new PaymentService();
            _coffeeService           = new CoffeeService(_condimentServiceFactory, _paymentService, _appSettings);

            while (true)
            {
                string input = MainMenu();
                switch (input.ToLowerInvariant())
                {
                case "1":
                    OrderCoffee();
                    break;

                case "2":
                    ReviewOrder();
                    break;

                case "3":
                    CancelOrder();
                    break;

                case "4":
                    Pay();
                    break;

                case "q":
                    return;
                }
            }
        }
Пример #3
0
 public void SetUp()
 {
     _appSettingsMock = new Mock <IApplicationSettingsService>();
     _factory         = new CondimentServiceFactory(_appSettingsMock.Object);
 }