public void Test_RFIDEVENT_DoorOpen_NoDisplay() { //Act // Vi vil gerne teste at når der // Bliver læst et RFID event, printes der ikke noget //Raiser et doorevent så døren åbnes _door.DoorEvent += Raise.EventWith(new DoorEventArgs() { IsDoorOpen = true }); _display.ClearReceivedCalls(); _rfid.RfidEvent += Raise.EventWith(new RfidEventArgs() { RfidTag = 1234 }); _display.DidNotReceive().print(Arg.Any <string>()); }
public void setup() { _uut = new StationControl(display, logfile, chargeControl, door, reader); display.ClearReceivedCalls(); logfile.ClearReceivedCalls(); chargeControl.ClearReceivedCalls(); door.ClearReceivedCalls(); reader.ClearReceivedCalls(); }
public void RfidDectected_RfidDetectedInDoorOpenState_DisplayNothing() { //arrange _door.DoorOpenEvent += Raise.EventWith(EventArgs.Empty); _display.ClearReceivedCalls(); //Act _rfidReader.RfidDetectedEvent += Raise.Event <EventHandler <int> >(_rfidReader, 123); //Assert var calls = _display.ReceivedCalls(); Assert.That(!calls.Any()); }
[TestCase(19, 250)] //Max Boundary + 5 public void Press_PowerButton_DisplayCorrectValues(int press, int watts) { for (int i = 0; i < press - 1; i++) { sut_PowerButton.Press(); } //press = 18; fakeDisplay.ClearReceivedCalls(); fakeDisplay.Received(0).ShowPower(Arg.Any <int>()); sut_PowerButton.Press(); fakeDisplay.Received().ShowPower(watts); }
public void HandleRfidRead_Ignored_If_Door_Open() { //Arrange _door.DoorChangeEvent += Raise.EventWith <DoorOpenEventArgs>(_door, new DoorOpenEventArgs() { IsOpen = true }); _display.ClearReceivedCalls(); //clear the print from opening the door //Act _rfidReader.ReadIdEvent += Raise.EventWith <RfidReadEventArgs>(_rfidReader, new RfidReadEventArgs() { Id = 3 }); //Assert _display.DidNotReceive().NotifyStation(Arg.Any <string>()); }
public void PowerPressing() { // Pressing power button shows power level. powerButton.Press(); display.Received(1).ShowPower(50); display.ClearReceivedCalls(); // Increase power level by 50. powerButton.Press(); display.Received(1).ShowPower(100); powerButton.Press(); display.Received(1).ShowPower(150); powerButton.Press(); display.Received(1).ShowPower(200); powerButton.Press(); display.Received(1).ShowPower(250); powerButton.Press(); display.Received(1).ShowPower(300); powerButton.Press(); display.Received(1).ShowPower(350); powerButton.Press(); display.Received(1).ShowPower(400); powerButton.Press(); display.Received(1).ShowPower(450); powerButton.Press(); display.Received(1).ShowPower(500); powerButton.Press(); display.Received(1).ShowPower(550); powerButton.Press(); display.Received(1).ShowPower(600); powerButton.Press(); display.Received(1).ShowPower(650); powerButton.Press(); display.Received(1).ShowPower(700); // Increasing power level beyond 700 makes it roll over. powerButton.Press(); display.Received(1).ShowPower(50); display.ClearReceivedCalls(); // Closing door. door.Close(); // Does nothing. display.DidNotReceive().ShowPower(Arg.Any <int>()); // Opening door. door.Open(); // Does not show power. display.DidNotReceive().ShowPower(Arg.Any <int>()); // But it does turn on light. light.Received(1).TurnOn(); // And clears display. display.Received(1).Clear(); }
public void RfidDetected_StateIsAvalibleAndConnected_CallLockDoorOnDoorAndStartChargeOnChargeControl() { //Arrange charger.IsConnected().Returns(true); door.DoorIsLocked.Returns(false); door.DoorIsOpen.Returns(false); door.closeDoorEvent += Raise.EventWith(new DoorEventArgs() { EventDoorState = DoorState.Closed }); disp.ClearReceivedCalls(); //Act rfid.RFIDReaderEvent += Raise.EventWith(new RFIDDetectedArgs { }); //Assert charger.Received(1).StartCharge(); door.Received(1).LockDoor(); disp.Received(1).DisplayMessage(Arg.Any <string>()); }