コード例 #1
0
        public void HealHp_ShouldHealUpToMax_WhenMoreThanMax()
        {
            // Arrange
            var instance = new HitPoints(42);

            instance.CurrentHp = 10;
            // Act
            instance.HealHp(100);
            // Assert
            instance.CurrentHp.Should().Be(42);
        }
コード例 #2
0
        public void HealHp_ShouldAddHp_WhenLessThanMax()
        {
            // Arrange
            var instance = new HitPoints(42);

            instance.CurrentHp = 10;
            // Act
            instance.HealHp(5);
            // Assert
            instance.CurrentHp.Should().Be(15);
        }
コード例 #3
0
        public void HealHp_ShouldDoNothing_WhenDead()
        {
            // Arrange
            var instance = new HitPoints(42);

            instance.CurrentHp = 0;
            instance.Status    = LifeStatuses.Dead;
            instance.DeathSavingThrowFailures  = 3;
            instance.DeathSavingThrowSuccesses = 1;
            // Act
            instance.HealHp(3);
            // Assert
            instance.CurrentHp.Should().Be(0);
            instance.Status.Should().Be(LifeStatuses.Dead);
            instance.DeathSavingThrowFailures.Should().Be(3);
            instance.DeathSavingThrowSuccesses.Should().Be(1);
        }
コード例 #4
0
        public void HealHp_ShouldStabilizeCharacter_WhenDying()
        {
            // Arrange
            var instance = new HitPoints(42);

            instance.CurrentHp = 0;
            instance.Status    = LifeStatuses.Dying;
            instance.DeathSavingThrowFailures  = 2;
            instance.DeathSavingThrowSuccesses = 1;
            // Act
            instance.HealHp(3);
            // Assert
            instance.CurrentHp.Should().Be(3);
            instance.Status.Should().Be(LifeStatuses.Stable);
            instance.DeathSavingThrowFailures.Should().Be(0);
            instance.DeathSavingThrowSuccesses.Should().Be(0);
        }