public void AreEqual_should_return_false_for_healthes_with_different_decay_pivots() { var health1 = new HealthWithDecay(0.5, currentTime - 1.Minutes()); var health2 = new HealthWithDecay(health1.Value, health1.DecayPivot - 1.Ticks()); implementation.AreEqual(health1, health2).Should().BeFalse(); }
public void AreEqual_should_return_true_for_healthes_with_equal_values_and_decay_pivots() { var health1 = new HealthWithDecay(0.5, currentTime - 1.Minutes()); var health2 = new HealthWithDecay(health1.Value, health1.DecayPivot); implementation.AreEqual(health1, health2).Should().BeTrue(); }
public void DecreaseHealth_should_update_decay_pivot_to_current_time() { var originalHealth = new HealthWithDecay(0.8, DateTime.MinValue); var modifiedHealth = implementation.DecreaseHealth(originalHealth); modifiedHealth.DecayPivot.Should().Be(currentTime); }
public void DecreaseHealth_should_not_exceed_minimum_health_value() { var originalHealth = new HealthWithDecay(0.003, DateTime.MinValue); var modifiedHealth = implementation.DecreaseHealth(originalHealth); modifiedHealth.Value.Should().Be(0.002); }
public void DecreaseHealth_should_multiply_health_value_by_down_multiplier() { var originalHealth = new HealthWithDecay(0.8, DateTime.MinValue); var modifiedHealth = implementation.DecreaseHealth(originalHealth); modifiedHealth.Value.Should().Be(0.2); }
public void IncreaseHealth_should_preserve_decay_point() { var originalHealth = new HealthWithDecay(0.6, currentTime - 2.Hours()); var modifiedHealth = implementation.IncreaseHealth(originalHealth); modifiedHealth.DecayPivot.Should().Be(originalHealth.DecayPivot); }
public void ModifyWeight_should_apply_full_health_damage_when_decay_pivot_is_equal_to_current_moment() { var weight = 2.0; var health = new HealthWithDecay(0.3, currentTime); implementation.ModifyWeight(health, ref weight); weight.Should().Be(0.6); }
public void ModifyWeight_should_not_modify_weight_if_current_health_has_maximum_value_and_recent_decay_pivot() { var weight = 2.0; var health = new HealthWithDecay(1.0, currentTime); implementation.ModifyWeight(health, ref weight); weight.Should().Be(2.0); }
public void ModifyWeight_should_partially_apply_health_damage_based_on_distance_from_decay_pivot() { var weight = 2.0; var health = new HealthWithDecay(0.3, currentTime - 3.Minutes()); implementation.ModifyWeight(health, ref weight); weight.Should().Be(1.44); // 2.0 * (0.3 + 0.7 * (3 / 5)) }
public void ModifyWeight_should_not_apply_any_health_damage_when_decay_pivot_is_in_distant_past() { var weight = 2.0; var health = new HealthWithDecay(0.3, currentTime - 5.Minutes()); implementation.ModifyWeight(health, ref weight); weight.Should().Be(2.0); }