1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
namespace MundusTests.ServiceTests.Tiles.Mobs
{
using Mundus.Data;
using Mundus.Service.Tiles.Items.Types;
using Mundus.Service.Tiles.Mobs;
using Mundus.Service.Windows;
using NUnit.Framework;
[TestFixture]
public static class MobTileTests
{
[Test]
public static void InstantiatesProperly()
{
MobTile mob = new MobTile("test", 10, 3, DataBaseContexts.SContext, 7, new Material("test_material"), 9);
Assert.AreEqual("test", mob.stock_id);
Assert.AreEqual(10, mob.Health);
Assert.AreEqual(3, mob.Defense);
Assert.AreEqual(DataBaseContexts.SContext, mob.CurrSuperLayer);
Assert.AreEqual(7, mob.Inventory.Hotbar.Length);
Assert.AreEqual("test_material", mob.DroppedUponDeath.stock_id);
Assert.AreEqual(9, mob.RndMovementRate);
}
[Test]
[TestCase(10, 3)]
[TestCase(19, 11)]
public static void AliveAfterTakingSmallDamage(int health, int damage)
{
MobTile mob = new MobTile("test", health, 3, DataBaseContexts.SContext);
Assert.IsTrue(mob.TakeDamage(damage));
}
[Test]
[TestCase(10, 10)]
[TestCase(13, 20)]
public static void DeadAfterTakingBigDamage(int health, int damage)
{
MobTile mob = new MobTile("test", health, 3, DataBaseContexts.SContext);
Assert.IsFalse(mob.TakeDamage(damage));
}
[Test]
[TestCase(10, 10)]
[TestCase(13, 20)]
public static void HealsProperly(int health, int healByPoints)
{
MobTile mob = new MobTile("test", health, 3, DataBaseContexts.SContext);
mob.Heal(healByPoints);
if (health + healByPoints > WI.SelWin.Size * 4)
{
Assert.AreEqual(WI.SelWin.Size, mob.Health);
}
else
{
Assert.AreEqual(health + healByPoints, mob.Health);
}
}
}
}
|