Пример #1
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);
      }
Пример #2
0
        public void Setup()
        {
            _output = Substitute.For <IOutput>();

            _uut_timer = new MicrowaveOvenClasses.Boundary.Timer();

            _uut_powerTube = new PowerTube(_output);

            _uut_powerButton       = new Button();
            _uut_timeButton        = new Button();
            _uut_startCancelButton = new Button();

            _uut_light = new Light(_output);

            _uut_door = new Door();

            _uut_display = new Display(_output);

            _uut_cooker = new CookController(_uut_timer, _uut_display, _uut_powerTube);

            _uut_ui = new UserInterface(
                _uut_powerButton, _uut_timeButton, _uut_startCancelButton,
                _uut_door,
                _uut_display,
                _uut_light,
                _uut_cooker);

            _uut_cooker.UI = _uut_ui;
        }
Пример #3
0
        public void Init()
        {
            _timer   = new Timer();
            _uutDoor = new Door();

            _output            = Substitute.For <IOutput>();
            _display           = new Display(_output);
            _powerTube         = new PowerTube(_output);
            _light             = new Light(_output);
            _powerButton       = Substitute.For <IButton>();
            _timeButton        = Substitute.For <IButton>();
            _startCancelButton = Substitute.For <IButton>();

            CookController cookController = new CookController(_timer, _display, _powerTube);

            _userInterface = new UserInterface(
                _powerButton,
                _timeButton,
                _startCancelButton,
                _uutDoor,
                _display,
                _light,
                cookController
                );

            cookController.UI = _userInterface;
            _cookController   = cookController;
        }
Пример #4
0
        public void SetUp()
        {
            //stubs
            _output    = Substitute.For <IOutput>();
            _timer     = Substitute.For <ITimer>();
            _powerTube = Substitute.For <IPowerTube>();
            _light     = Substitute.For <ILight>(); //Faked for at bryde loop i dep. tree

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



            //includes
            _display = new Display(_output);

            //Sut

            _cookController    = new CookController(_timer, _display, _powerTube);
            _iut               = new UserInterface(_powerButton, _timeButton, _startCancelButton, _door, _display, _light, _cookController);
            _cookController.UI = _iut;
        }
Пример #5
0
        public Program()
        {
            output = new Output();

            //Cooker
            timer     = new Timer();
            display   = new Display(output);
            powerTube = new PowerTube(output);

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


            //Userinterface
            powerButton       = new Button();
            timeButton        = new Button();
            startCancelButton = new Button();
            door  = new Door();
            light = new Light(output);
            ui    = new UserInterface(
                powerButton, timeButton, startCancelButton,
                door,
                display,
                light,
                cooker);

            cooker.UI = ui;
        }
Пример #6
0
        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;
        }
        public void Setup()
        {
            powerButtonSubstitute       = Substitute.For <IButton>();
            timeButtonSubstitute        = Substitute.For <IButton>();
            startCancelButtonSubstitute = Substitute.For <IButton>();
            powerTubeSubstitute         = Substitute.For <IPowerTube>();
            displaySubstitute           = Substitute.For <IDisplay>();
            lightSubstitute             = Substitute.For <ILight>();

            door  = new Door();
            timer = new Timer();

            uut = new CookController(timer, displaySubstitute, powerTubeSubstitute);

            ui = new UserInterface(
                powerButtonSubstitute,
                timeButtonSubstitute,
                startCancelButtonSubstitute,
                door,
                displaySubstitute,
                lightSubstitute,
                uut);

            uut.UI = ui;
        }
Пример #8
0
        public void SetUp()
        {
            #region Substitutes for paramaters for UserInterface and CookController

            // UserInterface
            _buttonPower       = Substitute.For <IButton>();
            _buttonTimer       = Substitute.For <IButton>();
            _buttonStartCancel = Substitute.For <IButton>();
            _door = Substitute.For <IDoor>();

            #endregion

            _output = Substitute.For <IOutput>();

            _light = new Light(_output);

            _timer     = Substitute.For <ITimer>();
            _display   = new Display(_output);
            _powerTube = new PowerTube(_output);

            _cookController = new CookController(_timer, _display, _powerTube);
            _userInterface  = new UserInterface(_buttonPower, _buttonTimer, _buttonStartCancel, _door, _display, _light,
                                                _cookController);
            _cookController.UI = _userInterface;
        }
Пример #9
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();
        }
Пример #10
0
        public void SetUp()
        {
            // Drivers
            _driverDoor              = new Door();
            _driverPowerButton       = new Button();
            _driverTimeButton        = new Button();
            _driverStartCancelButton = new Button();

            // Stubs/mocks
            _light     = Substitute.For <ILight>();
            _output    = Substitute.For <IOutput>();
            _powerTube = Substitute.For <IPowerTube>();
            _display   = Substitute.For <IDisplay>();

            // Unit under test
            _timer = new Timer();

            // Der var en null-reference på output fordi output først
            // blev initialiseret efter uut sådan som det stod før.

            // Included
            _cookController    = new CookController(_timer, _display, _powerTube);
            _userInterface     = new UserInterface(_driverPowerButton, _driverTimeButton, _driverStartCancelButton, _driverDoor, _display, _light, _cookController);
            _cookController.UI = _userInterface;
        }
Пример #11
0
        public void Setup()
        {
            _door              = Substitute.For <IDoor>();
            _powerButton       = new Button();
            _timeButton        = new Button();
            _startCancelButton = new Button();

            _output = Substitute.For <IOutput>();

            _display = new Display(_output);
            _light   = new Light(_output);

            _timer = new Timer();

            _powerTube      = new PowerTube(_output);
            _cookController = new CookController(_timer, _display, _powerTube);


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

            _cookController.UI = _sut;
        }
        public void Setup()
        {
            _timer     = Substitute.For <ITimer>();
            _powerTube = Substitute.For <IPowerTube>();

            _output = Substitute.For <IOutput>();

            _uut_powerButton       = new Button();
            _uut_timeButton        = new Button();
            _uut_startCancelButton = new Button();

            _uut_light = new Light(_output);

            _uut_door = new Door();

            _uut_display = new Display(_output);

            _uut_cooker = new CookController(_timer, _uut_display, _powerTube);

            _uut_ui = new UserInterface(
                _uut_powerButton, _uut_timeButton, _uut_startCancelButton,
                _uut_door,
                _uut_display,
                _uut_light,
                _uut_cooker);

            _uut_cooker.UI = _uut_ui;
        }
Пример #13
0
        public void Setup()
        {
            displaySubstitute = Substitute.For <IDisplay>();
            lightSubstitute   = Substitute.For <ILight>();
            outputSubstitute  = Substitute.For <IOutput>();

            powerTube = new PowerTube(outputSubstitute);

            powerButton       = new Button();
            timeButton        = new Button();
            startCancelButton = new Button();
            door  = new Door();
            timer = new Timer();

            uut = new CookController(timer, displaySubstitute, powerTube);

            ui = new UserInterface(
                powerButton,
                timeButton,
                startCancelButton,
                door,
                displaySubstitute,
                lightSubstitute,
                uut);

            uut.UI = ui;
        }
        public void Setup()
        {
            output = new Output();

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

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

            door  = new Door();
            timer = new Timer();

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

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

            uut.UI = ui;

            //Set standard streamwriter
            StreamWriter standardOut = new StreamWriter(Console.OpenStandardOutput());

            standardOut.AutoFlush = true;
            Console.SetOut(standardOut);
        }
Пример #15
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;
        }
        public void Setup()
        {
            output = Substitute.For <IOutput>();

            //Cooker
            timer     = Substitute.For <ITimer>();
            display   = new Display(output);
            powerTube = Substitute.For <IPowerTube>();

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


            //Userinterface
            powerButton       = new Button();
            timeButton        = new Button();
            startCancelButton = new Button();
            door  = new Door();
            light = new Light(output);
            ui    = new UserInterface(
                powerButton, timeButton, startCancelButton,
                door,
                display,
                light,
                uut);

            uut.UI = ui;
        }
        public void Setup()
        {
            // Stubs
            _timer     = Substitute.For <ITimer>();
            _powerTube = Substitute.For <IPowerTube>();
            _output    = Substitute.For <IOutput>();

            _powerButton       = Substitute.For <IButton>();
            _timeButton        = Substitute.For <IButton>();
            _startCancelButton = Substitute.For <IButton>();

            _light = Substitute.For <ILight>();

            // Included
            _uut_door    = new Door();
            _uut_display = new Display(_output);
            _uut_cooker  = new CookController(_timer, _uut_display, _powerTube);

            _uut_ui = new UserInterface(
                _powerButton, _timeButton, _startCancelButton,
                _uut_door,
                _uut_display,
                _light,
                _uut_cooker);

            _uut_cooker.UI = _uut_ui;
        }
        public void SetUp()
        {
            //stubs
            _output = Substitute.For <IOutput>();
            _timer  = Substitute.For <ITimer>();


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



            //includes
            _light     = new Light(_output);
            _display   = new Display(_output);
            _powerTube = new PowerTube(_output);


            //testing
            _cookController    = new CookController(_timer, _display, _powerTube);
            _iut               = new UserInterface(_powerButton, _timeButton, _startCancelButton, _door, _display, _light, _cookController);
            _cookController.UI = _iut;
        }
Пример #19
0
        public void Setup()
        {
            _powerButton       = new Button();
            _timeButton        = new Button();
            _startCancelButton = new Button();
            _door   = new Door();
            _output = Substitute.For <IOutput>();
            _light  = new Light(_output);


            _display = Substitute.For <IDisplay>();

            _timer     = Substitute.For <ITimer>();
            _powerTube = Substitute.For <IPowerTube>();

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

            _userInterface = new UserInterface(
                _powerButton,
                _timeButton,
                _startCancelButton,
                _door,
                _display,
                _light,
                _cookController);
        }
Пример #20
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();
        }
Пример #21
0
        static void Main(string[] args)
        {
            _output            = new Output();
            _powerTube         = new PowerTube(_output);
            _powerButton       = new Button();
            _timeButton        = new Button();
            _startCancelButton = new Button();
            _door      = new Door();
            _light     = new Light(_output);
            _display   = new Display(_output);
            _timer     = new Timer();
            _cooker    = new CookController(_timer, _display, _powerTube);
            _ui        = new UserInterface(_powerButton, _timeButton, _startCancelButton, _door, _display, _light, _cooker);
            _cooker.UI = _ui;

            _door.Open();
            _door.Close();

            _powerButton.Press();
            _powerButton.Press();
            _powerButton.Press();
            _powerButton.Press();


            _timeButton.Press();
            _timeButton.Press();
            _timeButton.Press();
            _timeButton.Press();

            _startCancelButton.Press();

            System.Console.WriteLine("Tast enter når applikationen skal afsluttes");
            System.Console.ReadKey();
        }
Пример #22
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);
 }
 public void SetUp()
 {
     _display        = Substitute.For <IDisplay>();
     _powerTube      = Substitute.For <IPowerTube>();
     _userInterface  = Substitute.For <IUserInterface>();
     _sut            = new Timer();
     _cookController = new CookController(_sut, _display, _powerTube, _userInterface);
 }
 public void Setup()
 {
     output_  = new Output();
     PT_      = new PowerTube(output_);
     display_ = new Display(output_);
     timer_   = Substitute.For <ITimer>();
     CC_      = new CookController(timer_, display_, PT_);
 }
Пример #25
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);
 }
Пример #26
0
 public void SetUp()
 {
     _iUserInterface = Substitute.For <IUserInterface>();
     _iTimer         = Substitute.For <ITimer>();
     _iPowerTube     = Substitute.For <IPowerTube>();
     _iOutput        = Substitute.For <IOutput>();
     _display        = new Display(_iOutput);
     _cookController = new CookController(_iTimer, _display, _iPowerTube, _iUserInterface);
 }
Пример #27
0
 public void Setup()
 {
     _timer        = Substitute.For <ITimer>();
     _output       = new Output();
     _display      = new Display(_output);
     _powerTube    = new PowerTube(_output);
     _stringWriter = new StringWriter();
     _sut          = new CookController(_timer, _display, _powerTube);
 }
        public void Setup()
        {
            ui        = Substitute.For <IUserInterface>();
            timer     = Substitute.For <ITimer>();
            display   = Substitute.For <IDisplay>();
            powerTube = Substitute.For <IPowerTube>();

            uut = new CookController(timer, display, powerTube, ui);
        }
Пример #29
0
 public void SetUp()
 {
     _userInterface = Substitute.For <IUserInterface>();
     _timer         = new Timer();
     _powerTube     = Substitute.For <IPowerTube>();
     _output        = Substitute.For <IOutput>();
     _display       = new Display(_output);
     _sut           = new CookController(_timer, _display, _powerTube, _userInterface);
 }
Пример #30
0
        public void Setup()
        {
            _timer     = new MicrowaveOvenClasses.Boundary.Timer();
            _display   = Substitute.For <IDisplay>();
            _powerTube = Substitute.For <IPowerTube>();
            _ui        = Substitute.For <IUserInterface>();

            _uut = new CookController(_timer, _display, _powerTube, _ui);
        }