|
@ -3155,7 +3155,7 @@ async fn test_client_tries_to_start_two_trades() { |
|
|
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 0)
|
|
|
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 0)
|
|
|
})))).await.err().unwrap();
|
|
|
})))).await.err().unwrap();
|
|
|
|
|
|
|
|
|
assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::TradeError(TradeError::ClientAlreadyInTrade)));
|
|
|
|
|
|
|
|
|
assert!(matches!(ack.downcast::<TradeError>().unwrap(), TradeError::ClientAlreadyInTrade));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
#[async_std::test]
|
|
@ -3187,14 +3187,14 @@ async fn test_client_tries_trading_with_client_already_trading() { |
|
|
target: 0,
|
|
|
target: 0,
|
|
|
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 0)
|
|
|
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 0)
|
|
|
})))).await.err().unwrap();
|
|
|
})))).await.err().unwrap();
|
|
|
assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::TradeError(TradeError::OtherAlreadyInTrade)));
|
|
|
|
|
|
|
|
|
assert!(matches!(ack.downcast::<TradeError>().unwrap(), TradeError::OtherAlreadyInTrade));
|
|
|
|
|
|
|
|
|
let ack = ship.handle(ClientId(3), RecvShipPacket::DirectMessage(DirectMessage::new(1, GameMessage::TradeRequest(TradeRequest {
|
|
|
let ack = ship.handle(ClientId(3), RecvShipPacket::DirectMessage(DirectMessage::new(1, GameMessage::TradeRequest(TradeRequest {
|
|
|
client: 2,
|
|
|
client: 2,
|
|
|
target: 0,
|
|
|
target: 0,
|
|
|
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 1)
|
|
|
trade: TradeRequestCommand::Initialize(TradeRequestInitializeCommand::Initialize, 1)
|
|
|
})))).await.err().unwrap();
|
|
|
})))).await.err().unwrap();
|
|
|
assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::TradeError(TradeError::OtherAlreadyInTrade)));
|
|
|
|
|
|
|
|
|
assert!(matches!(ack.downcast::<TradeError>().unwrap(), TradeError::OtherAlreadyInTrade));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
#[async_std::test]
|
|
|