示例#1
0
        public void AddTemporaryHp_ShouldKeepHigherTemporyHp_WhenCalledAgainWithLowerNumber()
        {
            // Arrange
            var instance = new HitPoints(42);

            // Act
            instance.AddTemporaryHp(9);
            instance.AddTemporaryHp(2);
            // Assert
            instance.TemporaryHp.Should().Be(9);
        }
示例#2
0
        public void AddTemporaryHp_ShouldSetHigherTemporyHp_WhenCalledAgain()
        {
            // Arrange
            var instance = new HitPoints(42);

            // Act
            instance.AddTemporaryHp(5);
            instance.AddTemporaryHp(7);
            // Assert
            instance.TemporaryHp.Should().Be(7);
        }
示例#3
0
        public void AddTemporaryHp_ShouldSetTemporaryHp()
        {
            // Arrange
            var instance = new HitPoints(42);

            // Act
            instance.AddTemporaryHp(5);
            // Assert
            instance.TemporaryHp.Should().Be(5);
        }
示例#4
0
        public void AddTemporaryHp_ShouldDoNothing_WhenDead()
        {
            // Arrange
            var instance = new HitPoints(42);

            instance.Status = LifeStatuses.Dead;
            // Act
            instance.AddTemporaryHp(5);
            // Assert
            instance.TemporaryHp.Should().Be(0);
        }
示例#5
0
        public void DealDamages_ShouldUseTemporaryHPThenCurrentHP_WhenNotEnough()
        {
            // Arrange
            var instance = new HitPoints(42);

            instance.AddTemporaryHp(5);
            var damages = new DealDamage[]
            {
                new DealDamage {
                    DamageType = DamageTypes.Fire, Hp = 10
                }
            };

            // Act
            instance.DealDamages(damages);
            // Assert
            instance.CurrentHp.Should().Be(37);
            instance.TemporaryHp.Should().Be(0);
        }