예제 #1
0
        public void Regulate_HigherTemp_HeaterTurnedOff(int temp)
        {
            _tempSensor.GetTemp().Returns(temp);
            _uut.Regulate();

            _heater.Received().TurnOff();
        }
예제 #2
0
 public void Regulate_thresholdIs10insertHighX_ExpectTurnOff(int X)
 {
     uut = new ECS(tempSensor, heater, 10);
     tempSensor.GetTemp().Returns(X);
     uut.Regulate();
     heater.Received(1).TurnOff();
 }
예제 #3
0
 public void Regulate_TempBelowThreshold_HeaterTurnedOn(int curTemp, int thres, int reg)
 {
     _fakeTempSensor.GetTemp().Returns(curTemp);
     _uut.SetThreshold(thres);
     _uut.Regulate();
     _fakeHeater.Received(reg).TurnOn();
 }
예제 #4
0
 public void TemperatureChanged_LowTemperatur_HeaterOnCalled(int newTemp)
 {
     _tempSource.TempChangedEvent += Raise.EventWith(new TempChangedEventArgs {
         Temp = newTemp
     });
     _heater.Received(1).TurnOn();
 }
예제 #5
0
 public void Regulate_TemperatureBelowHeaterThreshold_HeaterIsTurnedOn()
 {
     //Act
     _ecs.Regulate();
     //Assert
     _fakeheater.Received(1).TurnOn();
 }
예제 #6
0
        public void GetTemp_TempLowerThanThreshold()
        {
            _sensor.GetTemp().Returns(-51);
            _uut.Regulate();

            _heater.Received().TurnOn();
            _window.Received().Close();
        }
예제 #7
0
        public void Regulate_TempThresholdIs10TempIsNeg5_TurnOnCalled()
        {
            _tempSensor.GetSensorData().Returns(-5);

            uut.Regulate();

            _heater.Received(1).TurnOn();
        }
예제 #8
0
        public void TestTurnOn()
        {
            _uut = new ECSClass(35, 40, _fakeTempSensor, _fakeHeater, _fakeWindow);

            _uut.Regulate();

            _fakeHeater.Received(1).TurnOn();
        }
예제 #9
0
 public void RegulateSub_TempIsLow_HeaterIsTurnedOn()
 {
     // Setup substitude
     _subTempSensor.GetTemp().Returns(20);
     // Act
     _uutsub.Regulate();
     // Check if turnOn is called once
     _subHeater.Received(1).TurnOn();
     //_subWindow.Received(1).Close();
 }
예제 #10
0
        public void Regulate_tempIsLow_heaterIsTurnedOn()
        {
            // Setup stub with desired response
            _tempSensor.GetTemp().Returns(_uut.LowerTemperatureThreshold - 1);
            // Act
            _uut.Regulate();

            // Assert on the mock - was the heater called correctly
            _heater.Received(1).TurnOn();
        }
예제 #11
0
        public void Regulate_TempIsLow_HeaterIsTurnedOn()
        {
            // Setup stub with desired response
            _fakeTempSensor.GetTemp().Returns(24);
            // Act
            _uut.Regulate();

            // Assert on the mock - was the heater called correctly
            _fakeHeater.Received(1).TurnOn();
        }
        public void Regulate_thresholdIs10insertHighX_ExpectTurnOff(int X)
        {
            //Arrange
            _fakeTempSensor.GetTemp().Returns(X);

            //Act
            uut.Regulate();

            //Assert
            _fakeHeater.Received(1).TurnOff();
        }
        public void Regulate_HeaterTurnOff_CalledSuccessfully()
        {
            //Setting up stub
            _tempSensor.GetTemp().Returns(30);

            //Act
            _uut.Regulate();

            //Asserting on mock
            _heater.Received(1).TurnOff();
        }
        public void Regulate_TemperatureOverThreshold_ECSTurnOffHeater(int temp, int threshold)
        {
            //Arrange
            _tempSensor.GetTemp().Returns(temp);
            _ecsSystem.SetThreshold(threshold);

            //Act
            _ecsSystem.Regulate();
            //Assert
            _heater.Received(1).TurnOff();
        }
예제 #15
0
        public void Heater_IsTurnedOn_TurnOnAmountCorrect()
        {
            // Act

            _tempSensor.GetTemp().Returns(24);

            _uut.Regulate();

            // Assert
            _heater.Received(1).TurnOn();
            // Assert.That(_heater.TurnOnActivated,Is.EqualTo(1));
        }
예제 #16
0
        public void Regulate_TempIsLow_HeaterIsTurnedOn()
        {
            // Raise event in fake
            _fakeTempSensor.TempChangedEvent += Raise.EventWith <TempChangedEventArgs>(
                this,
                new TempChangedEventArgs()
            {
                Temp = 20
            });

            // Assert on the mock - was the heater called correctly
            _fakeHeater.Received(1).TurnOn();
        }
예제 #17
0
        public void SelfTests()
        {
            //Arrange
            tempSensor_.RunSelfTest().Returns(true);
            bool result = uut.RunSelfTest();

            //Assert
            Assert.Multiple(() =>
            {
                tempSensor_.Received().RunSelfTest();
                heater_.Received().RunSelfTest();
            });
        }
예제 #18
0
 public void Regulate_Regulate30Temp20_HeaterIsOn(int temp, int thresh, bool expectedResult)
 {
     sensor.GetTemp().Returns(temp);
     uut.SetThreshold(thresh);
     uut.Regulate();
     if (expectedResult == true)
     {
         heater.Received(1).TurnOn();
     }
     else
     {
         heater.Received(1).TurnOff();
     }
 }
예제 #19
0
            public void TestWithSub()//Da vi asserter på en mock er det en interaction-based test
            {
                //setup
                _fakeSensor.GetTemp().Returns(20);//fakeSensor fungerer som stub i denne test

                //Act
                UUT.Regulate();

                //Assert
                _fakeHeater.Received(1).TurnOn();//fakeHeater fungerer som en mock i denne test
            }
예제 #20
0
        public void TurnOff_SetThresholdUnderTempAndRegulate_TurnOffCalledOnce(int a)
        {
            //arrange
            uut2 = Substitute.For <IHeater>();
            uut1 = Substitute.For <ITempSensor>();
            uut3 = new global::ECS.Legacy.ECS(a, uut2, uut1);

            //act
            uut1.GetTemp().Returns(5);
            uut3.Regulate();

            //assert
            uut2.Received(1).TurnOff();
        }
예제 #21
0
        public void Regulate()
        {
            _tempsensor.GetTemp().Returns(24);
            _uut.Regulate();
            _heater.Received(1).TurnOn();



            //FakeTempSensor fakeTempTest = new FakeTempSensor(1);
            //FakeHeater fakeHeaterTest = new FakeHeater(false);
            //_uut = new Ecs(5, fakeTempTest, fakeHeaterTest);
            //_uut.SetThreshold(2);


            //_uut.Regulate();
            //Assert.IsTrue(fakeHeaterTest.Answer);
        }
예제 #22
0
 public void heaterOnWhenTempBelowThreshold()
 {
     tempSensor_.GetTemp().Returns(15);
     ecs_.Regulate();
     heater_.Received(1).TurnOn();
 }
예제 #23
0
 public void Regulate_tempIsLow_HeaterIsOn()
 {
     _fakeTempSensor.GetTemp().Returns(19);
     _uut.Regulate();
     _Heater.Received(1).TurnOn();
 }
예제 #24
0
 public void Regulate_TempBelowThreshold_HeaterTurnedOn()
 {
     uutTempSensor.GetTemp().Returns(20);
     uut.Regulate();
     uutHeater.Received(1).TurnOn();
 }
예제 #25
0
 public void Regulate_TempBelowThreshold_HeaterTurnOn()
 {
     _tempSensor.GetTemp().Returns(13);
     _uut.Regulate();
     _heater.Received(1).TurnOn();
 }
예제 #26
0
 public void RegulateHigh_Test()
 {
     _fakeTempSensor.GetTemp().Returns(26);
     _uut.Regulate();
     _fakeHeater.Received(1).TurnOff();
 }
 public void Regulate_thresholdIs10insertHighX_ExpectTurnOff(int X)
 {
     fakeTempSensor.GetTemp().Returns(X);
     uut.Regulate();
     fakeHeater.Received(1).TurnOn();
 }
예제 #28
0
 public void RegulateTemp_BelowThreshold_HeaterTurnOn()
 {
     _sensor.GetTemp().Returns(10);
     _uut.Regulate();
     _heater.Received(1).TurnOn();
 }
예제 #29
0
 public void Regulate_TempBelowThreshold_HeaterTurnedOn()
 {
     _tempSensor.GetTemp().Returns(_uut.LowerTemperatureThreshold - 10);
     _uut.Regulate();
     _heater.Received(1).TurnOn();
 }
예제 #30
0
파일: Program.cs 프로젝트: Vegobar/ECS_SWT
 public void test_HeaterTurnedOn()
 {
     _sensor.GetTemp().Returns(_uut.LowerTemperatureThreshold - 20);
     _uut.Regulate();
     _heater.Received(1).TurnOn();
 }