Using TDD first time in my life today. I am using nUnit.
I have one method, where I can insert multiple different inputs and check if result works.
I read that multiple asserts in one test is not a problem, and I really don't want to write new test for each input.
Example with multiple asserts:
[TestFixture] public class TestClass { public Program test; [SetUp] public void Init() { test = new Program(); } [Test] public void Parse_SimpleValues_Calculated() { Assert.AreEqual(25, test.ParseCalculationString("5*5")); Assert.AreEqual(125, test.ParseCalculationString("5*5*5")); Assert.AreEqual(10, test.ParseCalculationString("5+5")); Assert.AreEqual(15, test.ParseCalculationString("5+5+5")); Assert.AreEqual(50, test.ParseCalculationString("5*5+5*5")); Assert.AreEqual(3, test.ParseCalculationString("5-1*2")); Assert.AreEqual(7, test.ParseCalculationString("7+1-1")); } } But when something fails it is very hard to read which assert failed, I mean if you have them a lot, you have to go through all and find the right assert.
Is there any elegant way to show what input did we set if assert fails, instead of result and expected result?
Thank you.