public void ShouldThrowAProhibitedConnectAttemptExceptionWhenConnectIsCalledOnAReservedBridge() { //When clientBridge.ConfirmReservation(correlationId, TestConstants.TEST_RESERVATION_KEY); Action action = () => clientBridge.Connect(TestConstants.TEST_IP_ADDRESS, TestConstants.TEST_PLAYER_NAME); //Then action.ShouldThrow <ProhibitedConnectAttemptException>(); }
public void TheBridgeShouldThrowAProhibitedReservationRejectionExceptionWhenHandlingAReservationRejectionAfterConfirmingOne() { //When clientBridge.Connect(TestConstants.TEST_IP_ADDRESS, TestConstants.TEST_PLAYER_NAME); clientBridge.ConfirmReservation(correlationId, TestConstants.TEST_RESERVATION_KEY); Action action = () => clientBridge.HandleRejectedReservation(correlationId, TestConstants.TEST_REJECTION_STATE); //Then action.ShouldThrow <ProhibitedReservationRejectionException>(); }
public void ClaimingAReservationOnAReservedBridgeShouldMakeItConnected() { //When clientBridge.Connect(TestConstants.TEST_IP_ADDRESS, TestConstants.TEST_PLAYER_NAME); clientBridge.ConfirmReservation(correlationId, TestConstants.TEST_RESERVATION_KEY); clientBridge.ClaimReservation(); //Then clientBridge.CurrentState.Should().Be(ClientBridgeState.Connected); }
public void TheBridgeShouldBeReservedAfterConfirmingAReservation() { //When clientBridge.Connect(TestConstants.TEST_IP_ADDRESS, TestConstants.TEST_PLAYER_NAME); clientBridge.ConfirmReservation(correlationId, TestConstants.TEST_RESERVATION_KEY); //Then clientBridge.CurrentState.Should().Be(ClientBridgeState.Reserved); clientBridge.ReservationState.Should().Be(PlayerSlotReservationState.Reserved); }
public void ShouldBeAbleToSendAPacketThroughAConnectedClientBridge() { //When clientBridge.Connect(TestConstants.TEST_IP_ADDRESS, TestConstants.TEST_PLAYER_NAME); clientBridge.ConfirmReservation(correlationId, TestConstants.TEST_RESERVATION_KEY); clientBridge.ClaimReservation(); clientBridge.Send(packet); //Then serverClient.Received().Send(Arg.Is(packet)); }
public override void Process(PlayerSlotReservation packet) { if (packet.ReservationState == PlayerSlotReservationState.Reserved) { clientBridge.ConfirmReservation(packet.CorrelationId, packet.ReservationKey); } else { clientBridge.HandleRejectedReservation(packet.CorrelationId, packet.ReservationState); } }