public void NotFoundTest() { KSPHelper helper; try { helper = new KSPHelper(@"C:\Users\pavel\source\repos\KSPHelper\PathValidationTest\testData\definetlyExists", "test.in"); helper = new KSPHelper(@"C:\Users\pavel\source\repos\KSPHelper\PathValidationTest\testData\definetlyExists\test.in"); Assert.Fail("Chyba v kontrole"); } catch { //errors occurs, everything is okay } }
private bool validateInput(string path) { List <string[]> correctData = new List <string[]>(); foreach (var line in File.ReadAllLines(path)) { correctData.Add(line.Split(' ')); } string[] firstLine = correctData[0]; correctData.RemoveAt(0); KSPHelper helper = new KSPHelper(path); return(correctData.Equals(helper.Collection) && firstLine.Equals(helper.firstLine)); }
public void PathParsingTest() { KSPHelper pathCheck; try { //.in extension pathCheck = new KSPHelper(@"C:\Users\pavel\source\repos\KSPHelper\PathValidationTest\testData\pathTest", "test.in"); pathCheck = new KSPHelper(@"C:\Users\pavel\source\repos\KSPHelper\PathValidationTest\testData\pathTest\test.in"); //.txt extension pathCheck = new KSPHelper(@"C:\Users\pavel\source\repos\KSPHelper\PathValidationTest\testData\pathTest02", "test.txt"); pathCheck = new KSPHelper(@"C:\Users\pavel\source\repos\KSPHelper\PathValidationTest\testData\pathTest02\test.txt"); } catch { Assert.Fail(); } }
private bool validateOutput(string path) { string[] desired = { "ANO", "NE", "ANO", "MOZNA" }; KSPHelper helper = new KSPHelper(path); foreach (var ot in desired) { helper.AddOutput(ot); } helper.FlushOutput(); List <string> correctData = new List <string>(); foreach (var line in File.ReadAllLines(helper.outputFilePath)) { correctData.Add(line); } return(desired.Equals(correctData.ToArray())); }