public void GetNextCellValue_ShouldReturnOne_WhenInvokedForTheFirstTime() { var valueSequence = new BasicCellValueSequence(); var actualFirstValue = valueSequence.GetNextCellValue(); Assert.That(actualFirstValue, Is.EqualTo(1)); }
public void GetNextCellValue_ShouldIncrementValuesByOne() { var valueSequence = new BasicCellValueSequence(); for (int i = 0; i < 1000; i++) { valueSequence.GetNextCellValue(); } var value = valueSequence.GetNextCellValue(); var nextValue = valueSequence.GetNextCellValue(); Assert.That(value + 1, Is.EqualTo(nextValue)); }
public static void Main() { var ui = new BasicUserInterface(Console.WriteLine, Console.ReadLine); var inputMatrixSize = ui.AskForInput("Enter matrix size: "); int parsedMatrixSize; var isSuccessfullyParsed = int.TryParse(inputMatrixSize, out parsedMatrixSize); if (isSuccessfullyParsed) { var theMatrix = new BasicMatrix(parsedMatrixSize, InstantiatingMethods.CreateMatrixCell); var directionSequence = new BasicPathDirectionSequence(InstantiatingMethods.CreateDirection); var valuesGenerator = new BasicCellValueSequence(); var startPosition = new Position(0, 0); theMatrix.Populate(startPosition, directionSequence, valuesGenerator); ui.PostMessage(theMatrix.ToString()); } else { ui.PostMessage("Invalid matrix size input."); } }