As the title suggests, is this test name just a little of the top?
WhenChargeIsGreaterThanRestingChargeButLessThanChargeRestApproachStep_OnUpdate_ChargeIsSetToRestingCharge
Any suggestions on how to improve this? or is it fine as it is?
Below is the whole test fixture as it stands so you can get some context :)
public class NeuronTests
{
[Fact]
public void OnUpdate_NeuronFiresWhenChargeIsEqualToThreshold()
{
Neuron neuron = new Neuron();
bool fired = false;
neuron.Fired += (s, e) => fired = true;
neuron.Charge = Neuron.ChargeThreshold;
neuron.Update();
Assert.True(fired, "Neuron didn't fire");
}
[Fact]
public void OnUpdate_NeuronDoesntFireWhenChargeIsLessThanThreshold()
{
Neuron neuron = new Neuron();
bool fired = false;
neuron.Fired += (s, e) => fired = true;
neuron.Charge = Neuron.ChargeThreshold - 1f;
neuron.Update();
Assert.False(fired, "Neuron fired!");
}
[Fact]
public void OnUpdate_NeuronFiresWhenChargeIsGreaterThanThreshold()
{
Neuron neuron = new Neuron();
bool fired = false;
neuron.Fired += (s, e) => fired = true;
neuron.Charge = Neuron.ChargeThreshold + 1f;
neuron.Update();
Assert.True(fired, "Neuron didn't fire");
}
[Fact]
public void WhenNeuronFires_ChargeResetsToRestingCharge()
{
Neuron neuron = new Neuron();
neuron.Charge = Neuron.ChargeThreshold;
neuron.Update();
Assert.Equal(Neuron.RestingCharge, neuron.Charge);
}
[Fact]
public void AfterFiring_OnUpdate_NeuronWontFire()
{
Neuron neuron = new Neuron();
int fireCount = 0;
ne