Exemplo n.º 1
0
 public void Setup()
 {
     uutFakeTempSensor = new FakeTempSensor();
     uutFakeHeater     = new FakeHeater();
     uutFakeWindow     = new FakeWindow();
     uut = new Ecs(15, 25, uutFakeTempSensor, uutFakeHeater, uutFakeWindow);
 }
 public void SetUp()
 {
     _sensor = new FakeSensor();
     _heater = new FakeHeater();
     _window = new FakeWindow();
     uut     = new Refactored.ECS(28, 28, _sensor, _heater, _window);
 }
 public void Setup()
 {
     // Create the fake stubs and mocks
     _fakeHeater     = new FakeHeater();
     _fakeTempSensor = new FakeTempSensor();
     _fakeWindow     = new FakeWindow();
     // Inject them into the uut via the constructor
     _uut = new ECS(_fakeTempSensor, _fakeHeater, _fakeWindow, 25, 28);
 }
        public void GetCurTemp_GetCurTempIsCalled_Returns15()
        {
            var fakeHeater     = new FakeHeater();
            var fakeWindow     = new FakeWindow();
            var fakeTempSensor = new FakeTempSensor();

            fakeTempSensor.Temp = 15;
            var uut = new NewDesign.ECS(0, 0, fakeTempSensor, fakeHeater, fakeWindow);

            Assert.That(uut.GetCurTemp() == 15);
        }
        public void Regulate_TempIsEqualToThr_HeaterTurnsOff()
        {
            var fakeHeater     = new FakeHeater();
            var fakeWindow     = new FakeWindow();
            var fakeTempSensor = new FakeTempSensor();
            var uut            = new NewDesign.ECS(0, 0, fakeTempSensor, fakeHeater, fakeWindow);

            fakeTempSensor.Temp = 25;
            uut.SetHeaterThreshold(25);
            uut.Regulate();
            Assert.That(fakeHeater.TurnOffHasBeenCalled == true);
        }
        public void SetWindowThreshold_SetterCalled_WindowThrIsAlwaysEqualToOrGreaterThanHeatThr(int winThr, int heatThr)
        {
            var fakeHeater     = new FakeHeater();
            var fakeWindow     = new FakeWindow();
            var fakeTempSensor = new FakeTempSensor();
            var uut            = new NewDesign.ECS(0, 0, fakeTempSensor, fakeHeater, fakeWindow);

            uut.SetHeaterThreshold(heatThr);
            uut.SetWindowThreshold(winThr);

            Assert.That(uut.GetHeaterThreshold() <= uut.GetWindowThreshold());
        }
        public void Regulate_TempIsHigherThanThr_WindowOpens()
        {
            var fakeHeater     = new FakeHeater();
            var fakeWindow     = new FakeWindow();
            var fakeTempSensor = new FakeTempSensor();
            var uut            = new NewDesign.ECS(0, 0, fakeTempSensor, fakeHeater, fakeWindow);

            fakeTempSensor.Temp = 30;
            uut.SetWindowThreshold(25);
            uut.Regulate();
            Assert.That(fakeWindow.WindowIsOpen == true);
        }
        public void Regulate_TempIsEqualToThr_WindowCloses()
        {
            var fakeHeater     = new FakeHeater();
            var fakeWindow     = new FakeWindow();
            var fakeTempSensor = new FakeTempSensor();
            var uut            = new NewDesign.ECS(0, 0, fakeTempSensor, fakeHeater, fakeWindow);

            fakeTempSensor.Temp = 25;
            uut.SetWindowThreshold(25);
            uut.Regulate();
            Assert.That(fakeWindow.WindowIsClosed == true);
        }
Exemplo n.º 9
0
        public void Setup()
        {
            // Create the fake stubs and mocks
            _fakeHeater     = new FakeHeater();
            _fakeTempSensor = new FakeTempSensor();
            _fakeWindow     = new FakeWindow();

            _subTempSensor = Substitute.For <ITempSensor>();
            _subHeater     = Substitute.For <IHeater>();
            _subWindow     = Substitute.For <IWindow>();

            // Inject them into the uut via the constructor
            _uut    = new ECS(_fakeTempSensor, _fakeHeater, _fakeWindow, 25, 28);
            _uutsub = new ECS(_subTempSensor, _subHeater, _subWindow, 25, 28);
        }