public void TestEvenSequence() { NumbericSequence ns = new NumbericSequence(6); List<string> actual = ns.GetEvenSequence(); List<string> expected = new List<string>(); expected.Add("2"); expected.Add("4"); expected.Add("6"); CollectionAssert.AreEqual(actual, expected); }
public void TestFibonacciSequence() { NumbericSequence ns = new NumbericSequence(16); List<string> actual = ns.GetFibonacciSequence(); List<string> expected = new List<string>(); expected.Add("0"); expected.Add("1"); expected.Add("1"); expected.Add("2"); expected.Add("3"); expected.Add("5"); expected.Add("8"); expected.Add("13"); expected.Add("16"); CollectionAssert.AreEqual(actual, expected); }
public async Task<ActionResult> Sequence(NumbericSequence model) { // var inputNumberValue = Request["inputNumberValue"]; if (ModelState.IsValid) { List<string> result = new List<string>(); model = new NumbericSequence(model.CurrentNumber); result = null; if (Request.Form["Sequence"] != null) { result = model.GetSequence(); } if (Request.Form["OddSequence"] != null) { result = model.GetOddSequence(); } if (Request.Form["EvenSequence"] != null) { result = model.GetEvenSequence(); } if (Request.Form["CEZSequence"] != null) { result = model.GetCEZSequence(); } if (Request.Form["FibonacciSequence"] != null) { result = model.GetFibonacciSequence(); } model.SequenceResult = result; } return View(model); }
public void TestCEZSequence() { NumbericSequence ns = new NumbericSequence(16); List<string> actual = ns.GetCEZSequence(); List<string> expected = new List<string>(); expected.Add("1"); expected.Add("2"); expected.Add("C"); expected.Add("4"); expected.Add("E"); expected.Add("C"); expected.Add("7"); expected.Add("8"); expected.Add("C"); expected.Add("E"); expected.Add("11"); expected.Add("C"); expected.Add("13"); expected.Add("14"); expected.Add("Z"); expected.Add("16"); CollectionAssert.AreEqual(actual, expected); }