private void VerifyEarningsForPeriod(long ukprn, long?uln, string periodName, int colIndex, TableRow earnedRow) { if (earnedRow == null) { return; } var earnedByPeriod = StepDefinitionsContext.GetProviderEarnedByPeriod(ukprn, uln); if (!earnedByPeriod.ContainsKey(periodName)) { Assert.Fail($"Expected value for period {periodName} but none found"); } var expectedEarning = decimal.Parse(earnedRow[colIndex]); Assert.IsTrue(earnedByPeriod.ContainsKey(periodName), $"Expected earning for period {periodName} but none found"); Assert.AreEqual(expectedEarning, Math.Round(earnedByPeriod[periodName], 2), $"Expected earning of {expectedEarning} for period {periodName} but found {earnedByPeriod[periodName]}"); }