public void WriteResult(FibonacciResultSet results) { using (Stream stream = File.Create(_fileName)) using (StreamWriter writer = new StreamWriter(stream)) { for (int i = 0; i < results.GetAllResults().Length; i++) { writer.Write(string.Format("{0} ", results.GetAllResults()[i])); } } }
public void TestGetAllResults() { BigInteger[] data = { 0, 1, 2, 3 }; FibonacciResultSet testSet = new FibonacciResultSet { Results = data }; BigInteger[] allResults = testSet.GetAllResults(); CollectionAssert.AreEqual(data, allResults); }
public void WriteResult(FibonacciResultSet resultSet) { BigInteger[] results = resultSet.GetAllResults(); for (int i = 0; i < results.Length; i++) { Console.Write("{0} ", results[i]); } Console.WriteLine(); }
private static XDocument ConstructXMLDoc(FibonacciResultSet results) { IEnumerable<BigInteger> enumList = results.GetAllResults(); XDocument doc = new XDocument( new XElement("fiboutput", enumList.Select(n => new XElement("result", n.ToString())) ) ); return doc; }