private long GetFirstTriangleNumberWithAtLeastNDivisor(int requiredNumberOfDivisors) { int n = 1; var nthTriangleNumber = TriangleNumberHelper.GetNthTriangleNumber(n); while (DivisorHelper.GetNumberOfDivisors(nthTriangleNumber) < requiredNumberOfDivisors) { n++; nthTriangleNumber = TriangleNumberHelper.GetNthTriangleNumber(n); } return(nthTriangleNumber); }
public void GetNthTriangleNumber_ReturnsCorrectResult(int n, long nthTriangleNumber) { TriangleNumberHelper.GetNthTriangleNumber(n).Should().Be(nthTriangleNumber); }