Exemplo n.º 1
0
        public CoffeeOrderHandlerTests()
        {
            var path = Path.Combine(Directory.GetCurrentDirectory(), ConfigFileName);

            _config             = new CoffeeMachineConfiguration(path);
            _coffeeOrderHandler = new CoffeeOrderHandler(_config);
            _rnd = new Random();
        }
Exemplo n.º 2
0
        static IServiceProvider ConfigureServices()
        {
            var services = new ServiceCollection();

            var path   = Path.Combine(Directory.GetCurrentDirectory(), "coffee-machine-configuration.json");
            var config = new CoffeeMachineConfiguration(path);

            services
            .AddSingleton(config)
            .AddSingleton <frmMain>()
            .AddTransient <ITransactionHandler, TransactionHandler>()
            .AddTransient <ICoffeeOrderHandler, CoffeeOrderHandler>();

            return(services.BuildServiceProvider());
        }
        public CoffeeOrderHandler(CoffeeMachineConfiguration config)
        {
            _config = config;

            Reset();
        }