コード例 #1
0
        static void Main(string[] args)
        {
            // Setup all the objects,
            var door           = new Door();
            var powerButton    = new Button();
            var startButton    = new Button();
            var timeButton     = new Button();
            var output         = new Output();
            var light          = new Light(output);
            var powerTube      = new PowerTube(output);
            var display        = new Display(output);
            var timer          = new Timer();
            var cookController = new CookController(timer, display, powerTube);
            var ui             = new UserInterface(powerButton, timeButton, startButton, door, display, light, cookController);

            cookController.UI = ui;

            // Simulate user activities
            door.Open();
            door.Close();
            powerButton.Press();
            timeButton.Press();
            startButton.Press();

            // Wait while the classes, including the timer, do their job
            System.Console.WriteLine("Tast enter når applikationen skal afsluttes");
            System.Console.ReadLine();
        }
コード例 #2
0
 public void Setup()
 {
     str = new StringWriter();
     Console.SetOut(str);
     output = new Output();
     uut    = new PowerTube(output);
 }
コード例 #3
0
        static void Main(string[] args)
        {
            // Setup
            var door              = new Door();
            var powerButton       = new Button();
            var timeButton        = new Button();
            var startCancelButton = new Button();
            var output            = new Output();
            var display           = new Display(output);
            var light             = new Light(output);
            var powerTube         = new PowerTube(output);
            var timer             = new Timer();
            var cookController    = new CookController(timer, display, powerTube);
            var userInterface     = new UserInterface(powerButton, timeButton, startCancelButton, door, display, light, cookController);

            cookController.UI = userInterface;


            // User activities
            door.Open();
            door.Close();
            powerButton.Press();
            timeButton.Press();
            startCancelButton.Press();

            System.Console.WriteLine("Tast enter når applikationen skal afsluttes");
            System.Console.ReadLine();
        }
コード例 #4
0
        public void Setup()
        {
            // Initiate real modules
            _output         = new Output();
            _display        = new Display(_output);
            _light          = new Light(_output);
            _powerTube      = new PowerTube(_output);
            _timer          = new Timer();
            _cookController = new CookController(_timer, _display, _powerTube);

            // Create fakes
            _powerButton       = Substitute.For <IButton>();
            _timeButton        = Substitute.For <IButton>();
            _startCancelButton = Substitute.For <IButton>();
            _door = Substitute.For <IDoor>();

            // Capture output using stringWriter
            _stringWriter = new StringWriter();

            // Create Top
            _top = new UserInterface(_powerButton, _timeButton, _startCancelButton, _door, _display, _light, _cookController);

            // Assign _top as _cookController UI
            _cookController.UI = _top;
        }
コード例 #5
0
 public void Setup()
 {
     _output       = new Output();
     _powertube    = new PowerTube(_output);
     _stringWriter = new StringWriter();
     Console.SetOut(_stringWriter);
 }
コード例 #6
0
 public void Setup()
 {
     _output    = new Output();
     _light     = new Light(_output);
     _display   = new Display(_output);
     _powerTube = new PowerTube(_output);
 }
コード例 #7
0
      public void Setup()
      {
          _output = new Output();

          _powerButton       = new Button();
          _timeButton        = new Button();
          _startCancelButton = new Button();
          _door = new Door();

          _light = new Light(_output);


          _display = new Display(_output);


          _timer = new Timer();

          _powerTube = new PowerTube(_output);

          _cookController = new CookController(_timer, _display, _powerTube, _userInterface);

          _userInterface = new UserInterface(
              _powerButton,
              _timeButton,
              _startCancelButton,
              _door,
              _display,
              _light,
              _cookController);

          _str = new StringWriter();
          Console.SetOut(_str);
      }
コード例 #8
0
 public void Setup()
 {
     output_ = new Output();
     PT_     = new PowerTube(output_);
     SW_     = new StringWriter();
     Console.SetOut(SW_);
 }
コード例 #9
0
 public void Setup()
 {
     output       = new Output();
     power        = new PowerTube(output);
     stringWriter = new System.IO.StringWriter();
     Console.SetOut(stringWriter);
 }
コード例 #10
0
 public void Setup()
 {
     output      = new Output();
     sut         = new PowerTube(output);
     readConsole = new StringWriter();
     System.Console.SetOut(readConsole);
 }
コード例 #11
0
 public void SetUp()
 {
     _output = new Output();
     _uut    = new PowerTube(_output);
     _stw    = new StringWriter();
     Console.SetOut(_stw);
 }
コード例 #12
0
ファイル: IntegrationStep4.cs プロジェクト: I4SWT2019/Lab3
        public void Setup()
        {
            output = Substitute.For <IOutput>();

            timer = Substitute.For <ITimer>();

            powerButton       = new Button();
            timeButton        = new Button();
            startCancelButton = new Button();

            door = new Door();

            powerTube = new PowerTube(output);
            light     = new Light(output);
            display   = new Display(output);

            cooker = new CookController(timer, display, powerTube);

            userInterface = new UserInterface(
                powerButton, timeButton, startCancelButton, door,
                display, light,
                cooker);

            cooker.UI = userInterface;
        }
コード例 #13
0
        public void Setup()
        {
            _output = Substitute.For <IOutput>();

            _powerButton       = new Button();
            _timeButton        = new Button();
            _startCancelButton = new Button();
            _door = new Door();

            _light = new Light(_output);


            _display = new Display(_output);


            _timer = new Timer();

            _powerTube = new PowerTube(_output);

            _cookController = new CookController(_timer, _display, _powerTube, _userInterface);

            _userInterface = new UserInterface(
                _powerButton,
                _timeButton,
                _startCancelButton,
                _door,
                _display,
                _light,
                _cookController);
        }
コード例 #14
0
 public void SetUp()
 {
     _output         = Substitute.For <IOutput>();
     _display        = new Display(_output);
     _powerTube      = new PowerTube(_output);
     _timer          = new Timer();
     _cookController = new CookController(_timer, _display, _powerTube);
 }
コード例 #15
0
 public void Setup()
 {
     output_  = new Output();
     PT_      = new PowerTube(output_);
     display_ = new Display(output_);
     timer_   = Substitute.For <ITimer>();
     CC_      = new CookController(timer_, display_, PT_);
 }
 public void Setup()
 {
     _userInterface  = Substitute.For <IUserInterface>();
     _output         = Substitute.For <IOutput>();
     _timer          = new Timer();
     _display        = new Display(_output);
     _powerTube      = new PowerTube(_output);
     _cookController = new CookController(_timer, _display, _powerTube, _userInterface);
 }
コード例 #17
0
 public void SetUp()
 {
     _fakeUserInterface = Substitute.For <IUserInterface>();
     _fakeOutput        = Substitute.For <IOutput>();
     _fakeTimer         = Substitute.For <ITimer>();
     _display           = new Display(_fakeOutput);
     _powerTube         = new PowerTube(_fakeOutput);
     _sut = new CookController(_fakeTimer, _display, _powerTube, _fakeUserInterface);
 }
コード例 #18
0
        static void Main(string[] args)
        {
            // Setup all the objects,
            var output         = new Output();
            var door           = new Door();
            var pButton        = new Button();
            var tButton        = new Button();
            var scButton       = new Button();
            var display        = new Display(output);
            var powerTube      = new PowerTube(output);
            var timer          = new Timer();
            var cookController = new CookController(timer, display, powerTube);
            var light          = new Light(output);
            var userInterface  = new UserInterface(pButton, tButton, scButton, door, display, light, cookController);

            cookController.UI = userInterface;


            // Simulate user activities
            Console.WriteLine("Let's cook some food!\n");
            door.Open();
            door.Close();
            pButton.Press();
            Thread.Sleep(2000);
            pButton.Press();
            Thread.Sleep(500);
            pButton.Press();
            Thread.Sleep(500);
            pButton.Press();
            Thread.Sleep(500);
            pButton.Press();
            Thread.Sleep(2000);
            tButton.Press();
            scButton.Press();
            Thread.Sleep(5000);
            Console.Write("Nah, wrong settings ..\n\n");
            scButton.Press();
            Thread.Sleep(2000);
            pButton.Press();
            pButton.Press();
            tButton.Press();
            scButton.Press();
            Thread.Sleep(5000);
            Console.WriteLine("Nvm, not hungry\n");
            door.Open();
            Console.WriteLine("Or maybe I am\n");
            Thread.Sleep(1000);
            door.Close();
            Thread.Sleep(3000);
            pButton.Press();
            tButton.Press();
            scButton.Press();
            Thread.Sleep(1000 * 61);
            Console.WriteLine("FOOD!\n");
            door.Open();
        }
コード例 #19
0
        static void Main(string[] args)
        {
            Button startCancelButton = new Button();
            Button powerButton       = new Button();
            Button timeButton        = new Button();

            Door door = new Door();

            Output output = new Output();

            Display display = new Display(output);

            PowerTube powerTube = new PowerTube(output);

            Light light = new Light(output);

            Microwave.Classes.Boundary.Timer timer = new Timer();

            CookController cooker = new CookController(timer, display, powerTube);

            UserInterface ui = new UserInterface(powerButton, timeButton, startCancelButton, door, display, light, cooker);

            // Finish the double association
            cooker.UI = ui;

            door.Open();
            Console.WriteLine("Inserting food");
            door.Close();
            // Simulate a simple sequence
            for (int i = 0; i < 14; i++)
            {
                powerButton.Press();
            }


            for (int i = 0; i < 1; i++)
            {
                timeButton.Press();
            }


            startCancelButton.Press();

            Console.WriteLine();
            //door.Open();
            Console.WriteLine();

            // The simple sequence should now run

            System.Console.WriteLine("When you press enter, the program will stop");
            // Wait for input

            System.Console.ReadLine();
            //HEJ PALLE!
            //Hej ALEX!!
        }
コード例 #20
0
        static void Main(string[] args)
        {
            // Comment to test webhook
            Button startCancelButton = new Button();
            Button powerButton       = new Button();
            Button timeButton        = new Button();

            Door door = new Door();

            Output output = new Output();

            Display display = new Display(output);

            PowerTube powerTube = new PowerTube(output);

            Light light = new Light(output);

            MicrowaveOvenClasses.Boundary.Timer timer = new Timer();

            CookController cooker = new CookController(timer, display, powerTube);

            UserInterface ui = new UserInterface(powerButton, timeButton, startCancelButton, door, display, light, cooker);

            // Finish the double association
            cooker.UI = ui;

            // Simulate a simple sequence

            powerButton.Press();

            timeButton.Press();

            startCancelButton.Press();

            // The simple sequence should now run

            System.Console.WriteLine("When you press enter, the program will stop");

            //Output output = new Output();
            //Light light = new Light(output);
            //Display display = new Display(output);
            //PowerTube powerTube = new PowerTube(output);

            //light.TurnOn();
            //light.TurnOff();
            //Console.WriteLine();
            //display.ShowPower(100);
            //display.ShowTime(10, 10);
            //display.Clear();
            //Console.WriteLine();
            //powerTube.TurnOff();
            //powerTube.TurnOn(50);

            // Wait for input
            System.Console.ReadLine();
        }
コード例 #21
0
 public void SetUp()
 {
     _fakeOutput = Substitute.For <IOutput>();
     _timer      = new Timer();
     _display    = new Display(_fakeOutput);
     _powerTube  = new PowerTube(_fakeOutput);
     _sut        = new CookController(_timer, _display, _powerTube);
     _fakeUI     = Substitute.For <IUserInterface>();
     _sut.UI     = _fakeUI;
 }
コード例 #22
0
        public void SetUp()
        {
            _UI      = NSubstitute.Substitute.For <IUserInterface>();
            _display = NSubstitute.Substitute.For <IDisplay>();
            _output  = NSubstitute.Substitute.For <IOutput>();

            _timer          = new Timer();
            _powerTube      = new PowerTube(_output);
            _cookController = new CookController(_timer, _display, _powerTube, _UI);
        }
コード例 #23
0
 public void Setup()
 {
     // setting up our own out to write to instead of stdout
     // this lets us easily check what this out has received
     str = new StringWriter();
     Console.SetOut(str);
     output    = new Output();
     powertube = new PowerTube(output);
     display   = new Display(output);
     light     = new Light(output);
 }
コード例 #24
0
        static void Main(string[] args)
        {
            #region ObjectCreation

            var pB      = new Button();
            var tB      = new Button();
            var scB     = new Button();
            var door    = new Door();
            var output  = new Output();
            var display = new Display(output);
            var light   = new Light(output);
            var timer   = new Timer();
            var pt      = new PowerTube(output);
            var cC      = new CookController(timer, display, pt);
            var uI      = new UserInterface(pB, tB, scB, door, display, light, cC);
            cC.UI = uI;



            #endregion


            #region TestUseCase
            Console.WriteLine("Tast enter når applikationen skal afsluttes");
            Console.WriteLine("P for power. T for time. S for start/cancel. O for door open. C for door close");
            ConsoleKeyInfo read1 = Console.ReadKey();
            do
            {
                ConsoleKeyInfo read = Console.ReadKey();
                if (read.Key == ConsoleKey.P)
                {
                    pB.Press();
                }
                if (read.Key == ConsoleKey.T)
                {
                    tB.Press();
                }
                if (read.Key == ConsoleKey.S)
                {
                    scB.Press();
                }
                if (read.Key == ConsoleKey.O)
                {
                    door.Open();
                }
                if (read.Key == ConsoleKey.C)
                {
                    door.Close();
                }
            } while (read1.Key != ConsoleKey.Escape);


            #endregion
        }
コード例 #25
0
        public void Setup()
        {
            ui = Substitute.For <IUserInterface>();
            //output = new Output();
            output    = Substitute.For <IOutput>();
            timer     = new Timer();
            display   = new Display(output);
            powerTube = new PowerTube(output);

            controller = new CookController(timer, display, powerTube, ui);
        }
コード例 #26
0
        public void SetUp()
        {
            _display       = Substitute.For <IDisplay>();
            _timer         = Substitute.For <ITimer>();
            _userInterface = Substitute.For <IUserInterface>();

            _output         = new Output();
            _powertube      = new PowerTube(_output);
            _cookController = new CookController(_timer, _display, _powertube, _userInterface);
            _stringWriter   = new StringWriter();
            Console.SetOut(_stringWriter);
        }
コード例 #27
0
 public void Setup()
 {
     output_  = new Output();
     PT_      = new PowerTube(output_);
     display_ = new Display(output_);
     timer_   = new Classes.Boundary.Timer();
     UI_      = Substitute.For <IUserInterface>();
     CC_      = new CookController(timer_, display_, PT_);
     CC_      = new CookController(timer_, display_, PT_, UI_);
     SW_      = new StringWriter();
     Console.SetOut(SW_);
 }
コード例 #28
0
 public void Setup()
 {
     _userInterface  = Substitute.For <IUserInterface>();
     _output         = new Output();
     _powerTube      = new PowerTube(_output);
     _display        = new Display(_output);
     _timer          = new Classes.Boundary.Timer();
     _cookController = new CookController(_timer, _display, _powerTube);
     //_cookController = new CookController(_timer, _display, _powerTube, _userInterface);
     _stringWriter = new System.IO.StringWriter();
     Console.SetOut(_stringWriter);
 }
コード例 #29
0
ファイル: Step5.cs プロジェクト: toft1994/Microwave_SWT
        public void Setup()
        {
            //Initialize modules
            _timer          = new Timer();
            _output         = new Output();
            _powerTube      = new PowerTube(_output);
            _display        = new Display(_output);
            _userInterface  = Substitute.For <IUserInterface>();
            _cookController = new CookController(_timer, _display, _powerTube, _userInterface);

            _stringWriter = new StringWriter();
        }
コード例 #30
0
        public void Setup()
        {
            output        = new Output();
            powerTube     = new PowerTube(output);
            display       = new Display(output);
            userInterface = Substitute.For <IUserInterface>();
            timer         = new Timer();

            uut = new CookController(timer, display, powerTube, userInterface);

            str = new StringWriter();
            Console.SetOut(str);
        }