public void StReplaceParseTest5() { var target = new FileComponentAcs(); target.Eval("[File replace.Regex(\"file\", \"t\\s*from\", \"t to\")]"); Assert.Equal("content to file", target.Eval("[File get(\"file\")]")); }
public void StWriteParseTest3() { var target = new FileComponentAcs(); target.Eval("[File write(\"file\"): multi\nline\" \n 'data'.]"); Assert.Equal(" multi\nline\" \n 'data'.", target.Eval("[File get(\"file\")]")); }
public void StReplaceParseTest4() { var target = new FileComponentAcs(); target.Eval("[File replace.Wildcards(\"file\", \"con*from \", \"\")]"); Assert.Equal("file", target.Eval("[File get(\"file\")]")); }
public void StExistsParseTest4() { var target = new FileComponentAcs(); string realFile = Assembly.GetAssembly(GetType()).Location; Assert.Equal(Value.FALSE, target.Eval("[File exists.file(\"file\")]")); Assert.Equal(Value.TRUE, target.Eval("[File exists.file(\"" + realFile + "\")]")); }
public void StExistsParseTest3() { var target = new FileComponentAcs(); Assert.Equal(Value.FALSE, target.Eval("[File exists.directory(\"System32\", false)]")); //Assert.Equal(Value.VFALSE, target.parse("[File exists.directory(\"" + realDir + "\", true)]")); Assert.Equal(Value.TRUE, target.Eval("[File exists.directory(\"System32\", true)]")); }
public void StExistsParseTest2() { var target = new FileComponentAcs(); string realDir = Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location); Assert.Equal(Value.FALSE, target.Eval("[File exists.directory(\"c:\\stubdir\\notexist\")]")); Assert.Equal(Value.TRUE, target.Eval("[File exists.directory(\"" + realDir + "\")]")); }
public void StCallParseTest7() { var target = new FileComponentAcs(); Assert.Equal("stdout", target.Eval("[File call(\"file\", \"args\", 0)]")); Assert.Equal("silent stdout", target.Eval("[File scall(\"file\", \"args\", 15)]")); Assert.Equal("silent stdout", target.Eval("[File sout(\"file\", \"args\", 10)]")); }
public void StExistsParseTest5() { var target = new FileComponentAcs(); string realFile = Path.GetFileName(Assembly.GetAssembly(GetType()).Location); Assert.Equal(Value.FALSE, target.Eval("[File exists.file(\"cmd.exe\", false)]")); //Assert.Equal(Value.VFALSE, target.parse("[File exists.file(\"" + realFile + "\", true)]")); Assert.Equal(Value.TRUE, target.Eval("[File exists.file(\"cmd.exe\", true)]")); }
public void StCallParseTest6() { var target = new FileComponentAcs(); Assert.Throws <PMLevelException>(() => target.Eval("[File call(\"file\", 10)]") ); }
public void StGetParseTest3() { var target = new FileComponentAcs(true); Assert.Throws <FileNotFoundException>(() => target.Eval("[File get(\"file\")]") ); }
public void StExistsParseTest1() { var target = new FileComponentAcs(); Assert.Throws <IncorrectNodeException>(() => target.Eval("[File exists.stub(\"path\")]") ); }
public void StReplaceParseTest1() { var target = new FileComponentAcs(); Assert.Throws <PMLevelException>(() => target.Eval("[File replace(file, pattern, replacement)]") ); }
public void StWriteParseTest1() { var target = new FileComponentAcs(); Assert.Throws <IncorrectNodeException>(() => target.Eval("[File write(\"file\")]") ); }
public void StCallParseTest8() { var target = new FileComponentAcs(); Assert.Throws <IncorrectSyntaxException>(() => target.Eval("[File call(\"file\", \"args\", )]") ); }
public void StWriteParseTest2() { var target = new FileComponentAcs(); target.Eval("[File write(\"file\"):data]"); Assert.Equal("data", target.Eval("[File get(\"file\")]")); // append, writeLine, appendLine is identical for current accessor // however, also need checking the entry point as for the write() above: target.Eval("[File append(\"file\"):data]"); Assert.Equal("data", target.Eval("[File get(\"file\")]")); target.Eval("[File writeLine(\"file\"):data]"); Assert.Equal("data", target.Eval("[File get(\"file\")]")); target.Eval("[File appendLine(\"file\"):data]"); Assert.Equal("data", target.Eval("[File get(\"file\")]")); }
public void StGetParseTest2() { var target = new FileComponentAcs(); Assert.Equal("content from file", target.Eval("[File get(\"file\")]")); }