public void GetEnumeratorTest(long lowLimit, long upLimit, long[] expectedSequence) { // Arrange FiboSequence sequence = new FiboSequence(lowLimit, upLimit); // Act long[] membersOfSequence = sequence.GetSequence().ToArray(); // Assert Assert.IsTrue(membersOfSequence.SequenceEqual(expectedSequence)); }
public void GetSequence_WhenCalledReturns_IEnumerableSequence(int start, int limit, int[] expected) { // Arrange FiboSequence fiboSequence = new FiboSequence(start, limit); // Act int[] actual = fiboSequence.GetSequence().ToArray(); bool areEqual = actual.SequenceEqual(expected); // Assert Assert.IsTrue(areEqual); }
public void Run(string[] args) { _view.PrintTitleText(MessagesResources.ApplicationName); try { _inboxParams = new MainParamValidator(args).GetMainParameters(); } catch (Exception ex) { _view.PrintErrorText(ex.Message); return; } if (_inboxParams.WorkMode == WorkMode.HelpMode) { _view.PrintInstructionText(MessagesResources.Instruction); return; } ISequence sequence; switch (_inboxParams.WorkMode) { case WorkMode.FibonaccіMode: sequence = new FiboSequence(_inboxParams.LowLimit, _inboxParams.UpLimit); _view.PrintResult(String.Format(MessagesResources.ResultFibonacciMode, _inboxParams.LowLimit, _inboxParams.UpLimit), sequence.GetSequence()); break; case WorkMode.PowMode: sequence = new PowSequence(_inboxParams.UpLimit); _view.PrintResult(String.Format(MessagesResources.ResultPowMode, _inboxParams.LowLimit, _inboxParams.UpLimit), sequence.GetSequence()); break; default: _view.PrintErrorText(MessagesResources.ErrorInvalidWorkMode); return; } }