[Add] Tests summary & fix scene

This commit is contained in:
2026-03-05 10:21:05 +07:00
parent 05c2619de4
commit 9580d76a53
10 changed files with 466 additions and 0 deletions
@@ -47,6 +47,9 @@ namespace YachtDice.Tests
shopPrice: shopPrice, sellPrice: sellPrice);
}
/// <summary>
/// Покупка проходит успешно при достаточном балансе.
/// </summary>
[Test]
public void TryPurchase_SucceedsWithSufficientCurrency()
{
@@ -59,6 +62,9 @@ namespace YachtDice.Tests
Assert.AreEqual(1, _inventory.OwnedModifiers.Count);
}
/// <summary>
/// Покупка отклоняется при нехватке валюты.
/// </summary>
[Test]
public void TryPurchase_FailsWhenBroke()
{
@@ -72,6 +78,9 @@ namespace YachtDice.Tests
Assert.AreEqual(0, _inventory.OwnedModifiers.Count);
}
/// <summary>
/// Постоянный модификатор нельзя приобрести повторно.
/// </summary>
[Test]
public void TryPurchase_PermanentCannotBeBoughtTwice()
{
@@ -85,6 +94,9 @@ namespace YachtDice.Tests
Assert.AreEqual(1, _inventory.OwnedModifiers.Count);
}
/// <summary>
/// Ограниченный модификатор можно купить несколько раз.
/// </summary>
[Test]
public void TryPurchase_LimitedCanBeReBought()
{
@@ -98,6 +110,9 @@ namespace YachtDice.Tests
Assert.AreEqual(2, _inventory.OwnedModifiers.Count);
}
/// <summary>
/// Успешная покупка вызывает событие OnItemPurchased.
/// </summary>
[Test]
public void TryPurchase_FiresPurchaseEvent()
{
@@ -112,6 +127,9 @@ namespace YachtDice.Tests
Assert.AreEqual("test", purchased.Id);
}
/// <summary>
/// Товар имеет состояние Available, когда его можно позволить себе купить.
/// </summary>
[Test]
public void GetItemState_Available_WhenCanAfford()
{
@@ -120,6 +138,9 @@ namespace YachtDice.Tests
Assert.AreEqual(ShopItemState.Available, _shop.GetItemState(mod));
}
/// <summary>
/// Товар имеет состояние TooExpensive при недостатке валюты.
/// </summary>
[Test]
public void GetItemState_TooExpensive_WhenCannotAfford()
{
@@ -129,6 +150,9 @@ namespace YachtDice.Tests
Assert.AreEqual(ShopItemState.TooExpensive, _shop.GetItemState(mod));
}
/// <summary>
/// После покупки постоянного модификатора его состояние становится Owned.
/// </summary>
[Test]
public void GetItemState_Owned_WhenPermanentPurchased()
{
@@ -139,6 +163,9 @@ namespace YachtDice.Tests
Assert.AreEqual(ShopItemState.Owned, _shop.GetItemState(mod));
}
/// <summary>
/// Покупка кости добавляет ее в коллекцию игрока.
/// </summary>
[Test]
public void TryPurchase_DiceItem_AddsToDiceCollection()
{
@@ -151,6 +178,9 @@ namespace YachtDice.Tests
Assert.AreEqual(1, _diceCollection.OwnedDice.Count);
}
/// <summary>
/// Одну и ту же кость нельзя купить повторно.
/// </summary>
[Test]
public void TryPurchase_DiceItem_CannotBeBoughtTwice()
{
@@ -164,6 +194,9 @@ namespace YachtDice.Tests
Assert.AreEqual(1, _diceCollection.OwnedDice.Count);
}
/// <summary>
/// После покупки кость отображается в магазине как Owned.
/// </summary>
[Test]
public void GetItemState_Dice_Owned_AfterPurchase()
{