|
|
@ -785,9 +785,8 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { |
|
|
|
async fn test_deposit_meseta() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
char1.meseta = 300;
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -812,20 +811,19 @@ async fn test_deposit_meseta() { |
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
|
assert!(char.meseta == 277);
|
|
|
|
assert!(char.bank_meseta == 23);
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 277);
|
|
|
|
assert!(c1_bank_meseta.0 == 23);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_deposit_too_much_meseta() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
char1.meseta = 300;
|
|
|
|
char1.bank_meseta = 999980;
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(999980)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -850,21 +848,19 @@ async fn test_deposit_too_much_meseta() { |
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
|
assert!(char.meseta == 300);
|
|
|
|
assert!(char.bank_meseta == 999980);
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 300);
|
|
|
|
assert!(c1_bank_meseta.0 == 999980);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_deposit_meseta_when_bank_is_maxed() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
char1.meseta = 300;
|
|
|
|
char1.bank_meseta = 999999;
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -889,10 +885,10 @@ async fn test_deposit_meseta_when_bank_is_maxed() { |
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
|
assert!(char.meseta == 300);
|
|
|
|
assert!(char.bank_meseta == 999999);
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 300);
|
|
|
|
assert!(c1_bank_meseta.0 == 999999);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1464,9 +1460,8 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { |
|
|
|
async fn test_withdraw_meseta() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
char1.bank_meseta = 300;
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1491,20 +1486,19 @@ async fn test_withdraw_meseta() { |
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
|
assert!(char.meseta == 23);
|
|
|
|
assert!(char.bank_meseta == 277);
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 23);
|
|
|
|
assert!(c1_bank_meseta.0 == 277);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_withdraw_too_much_meseta() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
char1.meseta = 999980;
|
|
|
|
char1.bank_meseta = 300;
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999980)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1529,20 +1523,19 @@ async fn test_withdraw_too_much_meseta() { |
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
|
assert!(char.meseta == 999980);
|
|
|
|
assert!(char.bank_meseta == 300);
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 999980);
|
|
|
|
assert!(c1_bank_meseta.0 == 300);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_withdraw_meseta_inventory_is_maxed() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
char1.meseta = 999999;
|
|
|
|
char1.bank_meseta = 300;
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1567,8 +1560,8 @@ async fn test_withdraw_meseta_inventory_is_maxed() { |
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
|
assert!(char.meseta == 999999);
|
|
|
|
assert!(char.bank_meseta == 300);
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 999999);
|
|
|
|
assert!(c1_bank_meseta.0 == 300);
|
|
|
|
}
|