public void WriteOutput(string Path, TestParameters parameters, TextWriter writer) { string[] data = GetData(parameters); string links = GetLinks(ParsePosition(Path), parameters); writer.Write(Template, data[0], links, data[1]); }
public string[] GetData(TestParameters parameters) { string[] output = new string[2]; int break1 = parameters.Rand.Next(parameters.Data); output[0] = new string('A', break1); output[1] = new string('B', parameters.Data - break1); return output; }
public string GetLinks(int[] positions, TestParameters parameters) { string links = ""; if (positions.Count() <= parameters.Depth) { for (int i = 0; i < parameters.FanOut; i++) { links += "<a href=\"" + GetChildPositionLink(positions, i) + "\"> Link </a><br />"; } } return links; }
public TestParameters GetTestParameters(HttpContext context) { var parameters = context.Request.Params; string[] fanOuts = parameters.GetValues("FanOut"); string[] depths = parameters.GetValues("Depth"); string[] datas = parameters.GetValues("Data"); string[] seeds = parameters.GetValues("Seed"); string fanOut = fanOuts != null ? fanOuts[0] : null; string depth = depths != null ? depths[0] : null; string data = datas != null ? datas[0] : null; string seed = seeds != null ? seeds[0] : null; if (!string.IsNullOrEmpty(fanOut) && !string.IsNullOrEmpty(depth) && !string.IsNullOrEmpty(data) && !string.IsNullOrEmpty(seed)) { try { TestParameters attemptedNewParameters = new TestParameters( Int32.Parse(fanOut) , Int32.Parse(depth) , Int32.Parse(data) , Int32.Parse(seed) ); CurrentParameters = attemptedNewParameters; } catch (FormatException ex) { Console.WriteLine(ex.ToString()); } } return CurrentParameters; }