public void RfidDetected_StateAvailableChargerConnected_StartCharge() { _chargeControl.IsConnected().Returns(true); _rfidReader.RFIDDetectedEvent += Raise.EventWith(new RFIDDetectedEventArgs()); _chargeControl.Received(1).StartCharge(); }
public void TestRfidDetected_StartCharge_Called() { _chargeControl.IsConnected().Returns(true); _rfid.RFIDEvent += Raise.Event <EventHandler <int> >(this, 123); _chargeControl.Received().StartCharge(); }
public void RfidDetected_DoorStatusFalse_ChargeIsConnectedTrue_ChargeControlReceived_StartCharge(int TestId) { _door.CurrentDoorStatus.Returns(false); _chargeControl.isConnected().Returns(true); _rfidReader.RFIDValueEvent += Raise.EventWith(new RFIDEventArgs { id = TestId }); _chargeControl.Received().StartCharge(); }
public void StationController_ChecksConnection_when_RfidDetected() { _door.DoorCloseEvent += Raise.Event(); _reader.RfidDetectedEvent += Raise.EventWith(new RfidDetectedEventArgs { id = 1403 }); _charger.Received(1).IsConnected(); }
public void ReadRFID_Startcharg() { _charger.Connected().Returns(true); _rfidReader.KeySwiped += Raise.EventWith(new KeySwipedEventArgs() { Id = 25 }); _charger.Received(1).StartCharge(); }
public void RfidDetected_NewRfidDetectedAvaliable_StartCharging() { _fChargeControl.Connected().Returns(true); _fRfidReader.RfidDetectedEvent += Raise.EventWith(new RfidEventArgs { Id = 12 }); _fChargeControl.Received(1).StartCharge(); }
public void RfidAvailableSuccess() { chargeControl.IsConnected().Returns(true); reader.RfidDetected += Raise.EventWith(new object(), new RfidDetectedEventArgs(123)); door.Received().LockDoor(); chargeControl.Received().StartCharge(); logfile.Received().logWrite(1, 123); display.Received().CloseDoorMsg(); Assert.AreEqual("Locked", _uut.state.ToString()); }
public void RFIDDetected_StateAvailableChargerConnected_ChargerCalled() { ChargeFake.connected().Returns(true); RFIDfake.RFIDEvent += Raise.EventWith(new RFIDEventArgs() { RFID = 1 }); ChargeFake.Received(1).startCharging(); }
public void Rfid_AvailableState(int id) { RfidEventArgs RfidArgs = new RfidEventArgs(id); _chargeControl.connection_establishment().Returns(true); _rfidreader.RfidHandler += Raise.EventWith(this, RfidArgs); //_rfidreader.RfidHandler += (sender, args) => receivedId = args.id_; _door.Received().Lock(); _chargeControl.Received().charge_control_start(); _disp.Received().PrintStationMsg(_NowChargingMsg); }
public void RFIDDetected_LockerAvailable_ChargerConnected() { _chargeControl.IsConnected().Returns(true); _rfidReader.RFIDChangedEvent += Raise.EventWith(new RFIEDEventArgs { RFID = 1 }); _door.Received(1).LockDoor(); _chargeControl.Received(1).StartCharge(); _logFile.Received(1).LogDoorLocked(1); _display.Received(1).Print("Skabet er låst og din telefon lades. Brug dit RFID tag til at låse op."); }
public void TestRfidDetected_Available_testStartCharging() { _chargeControl.IsConnected().Returns(true); _rfid.RfidEvent += Raise.EventWith(new RfidEventArgs() { RfidTag = 1234 }); _chargeControl.Received().StartCharge(); }
public void HandleRfidDataEvent_PhoneConnected_StartChargeCalled() { //Setup _chargeControl.IsConnected().Returns(true); //Act _rfidReader.RFIDEvent += Raise.EventWith(new RFIDDataEventArgs { RFIDtag = 123 }); //Assert _chargeControl.Received(1).StartCharge(); }
public void SwitchCaseAvailable_ChargerIsConnected_MethodStartChargeRecieved1() { //arrange chargeControl.IsConnected().Returns(true); //act rfidReader.RfidReaderEvent += Raise.EventWith(new RfidDetectedEventArgs { Id = 1200 }); //assert chargeControl.Received(1).IsConnected(); }
public void from_VACANT_DOOR_OPEN_NO_PHONE_CONNECTED_to_VACANT_DOOR_OPEN_PHONE_CONNECTED() { //arrange _doorSensor.DoorOpened += Raise.EventWith(EventArgs.Empty); //act _chargeControl.PhoneConnected += Raise.EventWith(EventArgs.Empty); //assert _chargeControl.Received(1).InitiateCharging(); _logger.Received(1).LogThis("Phone connected"); _userOutput.Received(1).Notify_PhoneConnectedCloseDoor(); }
public void LockDoor_StartCharge_PrintChargingOn_DoorLocked_are_called_when_chargeControl_Connected_is_true() { _door.DoorOpenEvent += Raise.EventWith(new EventArgDoorOpen { DoorOpen = false }); _charger.Connected = true; _rfidReader.IdReaderEvent += Raise.EventWith(new EventArgReader { ReadId = "id" }); _door.Received(1).LockDoor(); _charger.Received(1).StartCharge(); _display.Received(1).PrintChargingOn(); _log.Received(1).DoorLocked("id"); }
public void TestRfidDetected_Available_checkStartCharge() { //Arrange _chargeControl.isConnected().Returns(true); //Act _rfid.RfidEvent += Raise.EventWith(new RfidEventArgs() { Rfid_ID = 1234 }); //Assert _chargeControl.Received().StartCharge(); }
public void HandleRfidRead_Goes_From_Available_To_Locked_If_Connected() { _chargeControl.Connected.Returns(true); //Act _rfidReader.ReadIdEvent += Raise.EventWith <RfidReadEventArgs>(_rfidReader, new RfidReadEventArgs() { Id = 5 }); //Assert _door.Received().LockDoor(); _chargeControl.Received().StartCharge(); _display.Received().NotifyStation("The locker is locked and your phone is charging. Use your RFID tag to unlock it."); _logger.Received().WriteToLog("Locked with RFID: 5"); }
public void HandleRFIDReadAvaibleConnectedTest(int id, string outputString) { _chargeControl.IsConnected().Returns(true); _RFIDReader.RFIDReadEvent += Raise.EventWith <RFIDReadEventArgs>(new RFIDReadEventArgs() { ID = id }); _door.Received().LockDoor(); _logfile.Received().LogDoorLocked(id); _chargeControl.Received().StartCharge(); _display.Received().DisplayUserInstructions(Arg.Is <string>(outputString)); Assert.That(_sc._state, Is.EqualTo(StationControl.LadeskabState.Locked)); Assert.That(_sc._oldId, Is.EqualTo(id)); }
public void RfidDetected_IfIdDetectedAndLadeSkabAvaliableChargeControlStartCharge_ChargeControlIsCalled(int id, bool ConnectedBool, int CalledTimes) { //Arrange _chargeControl.Connected = ConnectedBool; //Act _reader.IDLoadedEvent += Raise.EventWith(new RfidIDEventArgs() { RFIDID = id }); //Assert _chargeControl.Received(CalledTimes).StartCharge(); }
public void RfidDetected_StateAvailableAndChargerConnected_StartChargeCallOnce() { //Arrange _fakeChargeControl.IsConnected().Returns(true); //Act - Event i fake _fakeRfidReader.RfidEvent += Raise.EventWith(new RfidEventArgs() { Id = 1 }); //Assert _fakeChargeControl.Received(1).StartCharge(); }
public void CheckIf_BehaviorIsRight_WhenLadeskabStateIsAvailable_AndChargerIsConnected(int rfidId) { _chargeControl.IsConnected().Returns(true); _rfidReaderSimulator.RFIDDetectedEvent += Raise.EventWith(new RFIDDetectedEventArgs() { RFIDDetected = rfidId }); _doorSimulator.Received(1).LockDoor(); _chargeControl.Received(1).StartCharge(); _logFileSimulator.Received(1).LogDoorLocked(rfidId); _displaySimulator.Received(1).ShowPhoneChargingMessage(); }
public void InitialRfidTest_IsConnectedTrue() { var id = 12; _iChargeControl.IsConnected().Returns(true); _iReader.TagDataEvent += Raise.EventWith(new ReadtagChangedEventArgs() { Tag = id }); _iDoor.Received().LockDoor(); _iDisplay.Received().DisplayMessage("Døren er låst"); _iChargeControl.Received().Regulate(); _iLogFile.Received().LogMessage("Skab låst med RFID: " + id + ""); _iDisplay.Received().DisplayMessage("Skabet er låst og din telefon lades. Brug dit RFID tag til at låse op."); }
public void ChargerEvent_ChargeIsConnectedTrue_StartChargeCalledOnChargeControl() { //Arrange ChargerConnectionValue args0 = new ChargerConnectionValue { ChargerConnected = true }; _chargeControlSource.ChargerConnectionValueEvent += Raise.EventWith(args0); DoorValueEventArgs args1 = new DoorValueEventArgs { DoorOpen = false }; _doorSource.DoorValueEvent += Raise.EventWith(args1); RFIDDetectedEventArgs args2 = new RFIDDetectedEventArgs { RFID = 54321 }; _RfidReader.RFIDDetectedEvent += Raise.EventWith(args2); //Act //Assert _chargeControlSource.Received().StartCharge(); }
public void StartCharge_WhenPhoneLockerIsAvailableChargerConnectedRfidDetected_CallReceived() { //ARRANGE UUT.State = PhoneLockerState.Available; fakeChargeControl.Connected = true; //ACT fakeRfidReader.RFIDDetectedEvent += Raise.EventWith(new RFIDDetectedEventArgs() { RFID = 0 }); //ASSERT fakeChargeControl.Received(1).StartCharge(); }
public void RfidDetected_StateAvailableAndChargerConnected_ChargerCalledOnce() { // Arrange _uut._state = StationControl.LadeskabState.Available; _fakeChargeControl.IsConnected().Returns(true); // Act - Raise event in fake _fakeRfidReader.RfidEvent += Raise.EventWith(new RfidEventArgs() { Id = 1 }); // Assert _fakeChargeControl.Received(1).StartCharge(); }
public void RfidDeected_LadeskabstateIsLockedAndIdIsEqualToOldId_CalsStopCharge(int newId) { //Act //Først fyrres eventet en gang for at skifte state fra avalible til Locked chargeControl.Connected = true; rfidReader.RFIDReaderEvent += Raise.EventWith(new RFIDReaderEventArg { ID = newId }); //Herefter fyrres eventet igen rfidReader.RFIDReaderEvent += Raise.EventWith(new RFIDReaderEventArg { ID = newId }); chargeControl.Received(1).StopCharge(); }
public void StationControl_RfidReadPhoneConnected_EventCalled() { _chargeControl.IsConnected().Returns(true); _uut.HandleRfidStatusEvent(this, new RfidReaderEventArgs() { ReadRFID = 1 }); Assert.Multiple(() => { _door.Received().LockDoor(); _chargeControl.Received().StartCharge(); _logFile.Received().LogDoorLocked(1); _display.Received().ShowOccupied(); }); }
public void RaisedDoorChangeEvent_Available_IsConnected_isTrue_StartCharge_Called(bool doorstatus, bool rfidstatus, bool isConnected) { //Ønsker at gøre state = available _door.DoorChangedEvents += Raise.EventWith(new DoorChangedEventArgs() { DoorStatus = doorstatus }); _chargeControl.IsConnected().Returns(isConnected); //Problem: Rfidstatus spiller ingen rolle i koden?? _rfidReader.RfidSensedEvents += Raise.EventWith(new RfidSensedEventArgs() { RfidSensed = rfidstatus, Id = 10 }); _chargeControl.Received().StartCharge(); }
public void RFIDEventhandler_StateAvailableDoorClosedChargerConnected_StartChargeCalled(int id) { _door.Closed = true; _usbccharge.Connected = true; _rfid.ScanEvent += Raise.EventWith(new ScanEventArgs { ID = id }); _chargecontrol.Received(1).StartCharge(); }
public void RfidEvent_LadeskabAvaliablePhoneConnected_ChargingStarts(string SimulatedId) { chargeControl.IsConnected().Returns(true); door.DoorCloseEvent += Raise.EventWith(null, new DoorEventArgs()); rfidReader.TagReadEvent += Raise.EventWith(null, new RfidEventArgs() { Id = SimulatedId }); chargeControl.Received(1).StartCharge(); }