Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var settings = BiscuitMakerSettingsLoader.LoadFromConfig();
            var maker    = BiscuitMakerFactory.Create(settings);
            var display  = new BiscuitMakerConsoleDisplay(maker);

            display.Render();

            var timer = new Timer
            {
                Interval  = 1000,
                Enabled   = true,
                AutoReset = true,
            };

            timer.Elapsed += (s, e) =>
            {
                BiscuitMakerManager.Tick(maker);
                display.Render();
            };

            ConsoleKeyInfo key;

            do
            {
                key = Console.ReadKey();

                switch (key.KeyChar)
                {
                case 'o':
                    BiscuitMakerManager.TurnOn(maker);
                    break;

                case 'p':
                    BiscuitMakerManager.Pause(maker);
                    break;

                case 'f':
                    BiscuitMakerManager.TurnOff(maker);
                    break;

                case 'q':
                    break;

                default:
                    Console.WriteLine("Unknown command");
                    break;
                }

                display.Render();
            } while (key.KeyChar != 'q');
        }
Exemplo n.º 2
0
 public void SetUp()
 {
     this.Maker = BiscuitMakerFactory.Create(settings);
 }
Exemplo n.º 3
0
        public void CreateWithNoSettingsTest()
        {
            Action create = () => BiscuitMakerFactory.Create();

            create.Should().NotThrow();
        }