Dondi Test case FAILING after code refracting

Hi guys,

In ActionMasterTest.cs, I changed the code as follows:

[Test]
public void T12Dondi10thFrameTurkey(){
	int[] rolls = { 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1 };
	pinFalls = rolls.ToList ();

	pinFalls.Add (10);
	Assert.AreEqual(reset,ActionMaster.NextAction (rolls.ToList()));

	pinFalls.Add (10);
	Assert.AreEqual(reset,ActionMaster.NextAction (rolls.ToList()));

	pinFalls.Add (10);
	Assert.AreEqual(endGame,ActionMaster.NextAction (rolls.ToList()));
}

But the test case is FAILING. I know Ben refracted it to just one Asset.AreEqual() call (and its working) but I just want to try it out like this.Can you please identify if I’m doing anything wrong.

Regards,

Faizan

It’s been a while, so you probably solved it already. The problem is likely here

pinFalls.Add (10);
Assert.AreEqual(reset,ActionMaster.NextAction (rolls.ToList()));

See, you are adding 10 to pinFalls, but in the next line you are checking against rolls. rolls doesn’t know about the 10 you just added to pinFalls as they are two separate things.

Try changing it to:

Assert.AreEqual(reset,ActionMaster.NextAction (pinFalls);

Privacy & Terms