|
@ -113,8 +113,8 @@ impl TradeItemBuilder { |
|
|
async fn test_trade_one_individual_item() {
|
|
|
async fn test_trade_one_individual_item() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut p1_inv = Vec::new();
|
|
|
let mut p1_inv = Vec::new();
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
@ -212,8 +212,8 @@ async fn test_trade_one_individual_item() { |
|
|
async fn test_trade_player2_to_player1() {
|
|
|
async fn test_trade_player2_to_player1() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut p2_inv = Vec::new();
|
|
|
let mut p2_inv = Vec::new();
|
|
|
p2_inv.push(entity_gateway.create_item(
|
|
|
p2_inv.push(entity_gateway.create_item(
|
|
@ -311,8 +311,8 @@ async fn test_trade_player2_to_player1() { |
|
|
async fn test_reverse_trade_ack_order() {
|
|
|
async fn test_reverse_trade_ack_order() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut p1_inv = Vec::new();
|
|
|
let mut p1_inv = Vec::new();
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
@ -410,8 +410,8 @@ async fn test_reverse_trade_ack_order() { |
|
|
async fn test_trade_one_stacked_item() {
|
|
|
async fn test_trade_one_stacked_item() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -512,8 +512,8 @@ async fn test_trade_one_stacked_item() { |
|
|
async fn test_trade_partial_stacked_item() {
|
|
|
async fn test_trade_partial_stacked_item() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -617,8 +617,8 @@ async fn test_trade_partial_stacked_item() { |
|
|
async fn test_trade_individual_both() {
|
|
|
async fn test_trade_individual_both() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_inv = vec![
|
|
|
let p1_inv = vec![
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
@ -780,8 +780,8 @@ async fn test_trade_individual_both() { |
|
|
async fn test_trade_stacked_both() {
|
|
|
async fn test_trade_stacked_both() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -948,8 +948,8 @@ async fn test_trade_stacked_both() { |
|
|
async fn test_trade_partial_stack_both() {
|
|
|
async fn test_trade_partial_stack_both() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -1122,8 +1122,8 @@ async fn test_trade_partial_stack_both() { |
|
|
async fn test_trade_same_stacked_item_to_eachother() {
|
|
|
async fn test_trade_same_stacked_item_to_eachother() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..3).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..3).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -1292,8 +1292,8 @@ async fn test_trade_same_stacked_item_to_eachother() { |
|
|
async fn test_trade_stacked_when_already_have_partial_stack() {
|
|
|
async fn test_trade_stacked_when_already_have_partial_stack() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..3).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..3).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -1430,8 +1430,8 @@ async fn test_trade_stacked_when_already_have_partial_stack() { |
|
|
async fn test_trade_individual_for_stacked() {
|
|
|
async fn test_trade_individual_for_stacked() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_inv = vec![
|
|
|
let p1_inv = vec![
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
@ -1598,8 +1598,8 @@ async fn test_trade_individual_for_stacked() { |
|
|
async fn test_trade_multiple_individual() {
|
|
|
async fn test_trade_multiple_individual() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_inv = vec![
|
|
|
let p1_inv = vec![
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
@ -1854,8 +1854,8 @@ async fn test_trade_multiple_individual() { |
|
|
async fn test_trade_multiple_stacked() {
|
|
|
async fn test_trade_multiple_stacked() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -2119,8 +2119,8 @@ async fn test_trade_multiple_stacked() { |
|
|
async fn test_trade_not_enough_inventory_space_individual() {
|
|
|
async fn test_trade_not_enough_inventory_space_individual() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_inv = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_inv = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -2240,8 +2240,8 @@ async fn test_trade_not_enough_inventory_space_individual() { |
|
|
async fn test_trade_not_enough_inventory_space_stacked() {
|
|
|
async fn test_trade_not_enough_inventory_space_stacked() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -2355,8 +2355,8 @@ async fn test_trade_not_enough_inventory_space_stacked() { |
|
|
async fn test_trade_stack_too_big() {
|
|
|
async fn test_trade_stack_too_big() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..8).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..8).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -2469,8 +2469,8 @@ async fn test_trade_stack_too_big() { |
|
|
async fn test_trade_meseta() {
|
|
|
async fn test_trade_meseta() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(2323)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(2323)).await.unwrap();
|
|
|
|
|
|
|
|
@ -2548,8 +2548,8 @@ async fn test_trade_meseta() { |
|
|
async fn test_trade_too_much_meseta() {
|
|
|
async fn test_trade_too_much_meseta() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
|
|
@ -2598,8 +2598,8 @@ async fn test_trade_too_much_meseta() { |
|
|
async fn test_trade_invalid_amount_of_meseta() {
|
|
|
async fn test_trade_invalid_amount_of_meseta() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
|
|
@ -2648,8 +2648,8 @@ async fn test_trade_invalid_amount_of_meseta() { |
|
|
async fn test_trade_meseta_request_and_items_dont_match() {
|
|
|
async fn test_trade_meseta_request_and_items_dont_match() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(4000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char2.id, Meseta(999000)).await.unwrap();
|
|
@ -2698,8 +2698,8 @@ async fn test_trade_meseta_request_and_items_dont_match() { |
|
|
async fn test_player_declined_trade() {
|
|
|
async fn test_player_declined_trade() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut ship = standard_ship(entity_gateway.clone());
|
|
|
let mut ship = standard_ship(entity_gateway.clone());
|
|
|
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|
|
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|
@ -2727,8 +2727,8 @@ async fn test_player_declined_trade() { |
|
|
async fn test_back_out_of_trade_last_minute() {
|
|
|
async fn test_back_out_of_trade_last_minute() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut p1_inv = Vec::new();
|
|
|
let mut p1_inv = Vec::new();
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
@ -2791,8 +2791,8 @@ async fn test_back_out_of_trade_last_minute() { |
|
|
async fn test_valid_trade_when_both_inventories_are_full() {
|
|
|
async fn test_valid_trade_when_both_inventories_are_full() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_inv = futures::future::join_all((0..30).map(|_| {
|
|
|
let p1_inv = futures::future::join_all((0..30).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -2931,8 +2931,8 @@ async fn test_valid_trade_when_both_inventories_are_full() { |
|
|
async fn test_invalid_trade_when_both_inventories_are_full() {
|
|
|
async fn test_invalid_trade_when_both_inventories_are_full() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_inv = futures::future::join_all((0..30).map(|_| {
|
|
|
let p1_inv = futures::future::join_all((0..30).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -3081,9 +3081,9 @@ async fn test_invalid_trade_when_both_inventories_are_full() { |
|
|
async fn test_client_tries_to_start_two_trades() {
|
|
|
async fn test_client_tries_to_start_two_trades() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
let (_user2, _char3) = new_user_character(&mut entity_gateway, "a3", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
let (_user2, _char3) = new_user_character(&mut entity_gateway, "a3", "a").await;
|
|
|
|
|
|
|
|
|
let mut ship = standard_ship(entity_gateway.clone());
|
|
|
let mut ship = standard_ship(entity_gateway.clone());
|
|
|
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|
|
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|
@ -3112,9 +3112,9 @@ async fn test_client_tries_to_start_two_trades() { |
|
|
async fn test_client_tries_trading_with_client_already_trading() {
|
|
|
async fn test_client_tries_trading_with_client_already_trading() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
let (_user2, _char3) = new_user_character(&mut entity_gateway, "a3", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
let (_user2, _char3) = new_user_character(&mut entity_gateway, "a3", "a").await;
|
|
|
|
|
|
|
|
|
let mut ship = standard_ship(entity_gateway.clone());
|
|
|
let mut ship = standard_ship(entity_gateway.clone());
|
|
|
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|
|
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|
@ -3149,8 +3149,8 @@ async fn test_client_tries_trading_with_client_already_trading() { |
|
|
async fn test_add_then_remove_individual_item() {
|
|
|
async fn test_add_then_remove_individual_item() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut p1_inv = Vec::new();
|
|
|
let mut p1_inv = Vec::new();
|
|
|
for _ in 0..2 {
|
|
|
for _ in 0..2 {
|
|
@ -3260,8 +3260,8 @@ async fn test_add_then_remove_individual_item() { |
|
|
async fn test_add_then_remove_stacked_item() {
|
|
|
async fn test_add_then_remove_stacked_item() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -3393,8 +3393,8 @@ async fn test_add_then_remove_stacked_item() { |
|
|
async fn test_add_then_remove_partial_stack() {
|
|
|
async fn test_add_then_remove_partial_stack() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack1 = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -3515,8 +3515,8 @@ async fn test_add_then_remove_partial_stack() { |
|
|
async fn test_add_then_remove_meseta() {
|
|
|
async fn test_add_then_remove_meseta() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(2323)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(2323)).await.unwrap();
|
|
|
|
|
|
|
|
@ -3599,8 +3599,8 @@ async fn test_add_then_remove_meseta() { |
|
|
async fn test_items_to_trade_data_does_not_match() {
|
|
|
async fn test_items_to_trade_data_does_not_match() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut p1_inv = Vec::new();
|
|
|
let mut p1_inv = Vec::new();
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
@ -3680,8 +3680,8 @@ async fn test_items_to_trade_data_does_not_match() { |
|
|
async fn test_items_to_trade_id_does_not_match() {
|
|
|
async fn test_items_to_trade_id_does_not_match() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut p1_inv = Vec::new();
|
|
|
let mut p1_inv = Vec::new();
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
@ -3749,8 +3749,8 @@ async fn test_items_to_trade_id_does_not_match() { |
|
|
async fn test_stack_is_same_amount_in_request_and_items_to_trade() {
|
|
|
async fn test_stack_is_same_amount_in_request_and_items_to_trade() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -3821,8 +3821,8 @@ async fn test_stack_is_same_amount_in_request_and_items_to_trade() { |
|
|
async fn test_stack_is_same_amount_in_request_and_items_to_trade2() {
|
|
|
async fn test_stack_is_same_amount_in_request_and_items_to_trade2() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let p1_stack = futures::future::join_all((0..2).map(|_| {
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
|
let mut entity_gateway = entity_gateway.clone();
|
|
@ -3893,8 +3893,8 @@ async fn test_stack_is_same_amount_in_request_and_items_to_trade2() { |
|
|
async fn test_items_to_trade_count_less_than() {
|
|
|
async fn test_items_to_trade_count_less_than() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_inv = vec![
|
|
|
let p1_inv = vec![
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
@ -3993,8 +3993,8 @@ async fn test_items_to_trade_count_less_than() { |
|
|
async fn test_items_to_trade_count_greater_than() {
|
|
|
async fn test_items_to_trade_count_greater_than() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(23)).await.unwrap();
|
|
|
entity_gateway.set_character_meseta(&char1.id, Meseta(23)).await.unwrap();
|
|
|
|
|
|
|
|
@ -4101,8 +4101,8 @@ async fn test_items_to_trade_count_greater_than() { |
|
|
async fn test_items_to_trade_count_mismatch_with_meseta() {
|
|
|
async fn test_items_to_trade_count_mismatch_with_meseta() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let p1_inv = vec![
|
|
|
let p1_inv = vec![
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
@ -4201,8 +4201,8 @@ async fn test_items_to_trade_count_mismatch_with_meseta() { |
|
|
async fn test_dropping_item_after_trade() {
|
|
|
async fn test_dropping_item_after_trade() {
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
|
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let (_user2, char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
|
|
|
|
|
|
let mut p1_inv = Vec::new();
|
|
|
let mut p1_inv = Vec::new();
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
|
p1_inv.push(entity_gateway.create_item(
|
|
|