|
4 | 4 | using System.Text; |
5 | 5 | using IPTables.Net.Iptables.Helpers; |
6 | 6 | using IPTables.Net.Supporting; |
7 | | -using NUnit.Framework; |
8 | 7 |
|
9 | 8 | namespace IPTables.Net.Tests |
10 | 9 | { |
11 | | - [TestFixture] |
12 | | - class EscapeHelperTests |
| 10 | + public class EscapeHelperTests |
13 | 11 | { |
14 | | - [Test] |
| 12 | + [Fact] |
15 | 13 | public void TestSpaces() |
16 | 14 | { |
17 | | - Assert.AreEqual("'a word'", ShellHelper.EscapeArguments("a word")); |
18 | | - Assert.AreEqual("singleword", ShellHelper.EscapeArguments("singleword")); |
| 15 | + Assert.Equal("'a word'", ShellHelper.EscapeArguments("a word")); |
| 16 | + Assert.Equal("singleword", ShellHelper.EscapeArguments("singleword")); |
19 | 17 | } |
20 | 18 |
|
21 | | - [Test] |
| 19 | + [Fact] |
22 | 20 | public void TestPipe() |
23 | 21 | { |
24 | | - Assert.AreEqual("'|'", ShellHelper.EscapeArguments("|")); |
25 | | - Assert.AreEqual("'a|word'", ShellHelper.EscapeArguments("a|word")); |
26 | | - Assert.AreEqual("singleword", ShellHelper.EscapeArguments("singleword")); |
| 22 | + Assert.Equal("'|'", ShellHelper.EscapeArguments("|")); |
| 23 | + Assert.Equal("'a|word'", ShellHelper.EscapeArguments("a|word")); |
| 24 | + Assert.Equal("singleword", ShellHelper.EscapeArguments("singleword")); |
27 | 25 | } |
28 | | - [Test] |
| 26 | + [Fact] |
29 | 27 | public void TestSpace() |
30 | 28 | { |
31 | | - Assert.AreEqual("a word", ShellHelper.BuildArgumentString(new []{"a", "word"})); |
32 | | - Assert.AreEqual("\"two words\"", ShellHelper.BuildArgumentString(new[] { "two words" })); |
33 | | - Assert.AreEqual("\"two words and \\\"punctuation\\\"\"", ShellHelper.BuildArgumentString(new[] { "two words and \"punctuation\"" })); |
34 | | - Assert.AreEqual("bash -c \"bash -c \\\"echo a\\\"\"", ShellHelper.BuildArgumentString(new[] { "bash", "-c", ShellHelper.BuildArgumentString(new []{"bash", "-c", "echo a"}) })); |
35 | | - Assert.AreEqual("bash -c \"bash -c \\\"echo \\\\\\\"a\\\\\\\"\\\"\"", ShellHelper.BuildArgumentString(new[] { "bash", "-c", ShellHelper.BuildArgumentString(new[] { "bash", "-c", "echo \"a\"" }) })); |
| 29 | + Assert.Equal("a word", ShellHelper.BuildArgumentString(new []{"a", "word"})); |
| 30 | + Assert.Equal("\"two words\"", ShellHelper.BuildArgumentString(new[] { "two words" })); |
| 31 | + Assert.Equal("\"two words and \\\"punctuation\\\"\"", ShellHelper.BuildArgumentString(new[] { "two words and \"punctuation\"" })); |
| 32 | + Assert.Equal("bash -c \"bash -c \\\"echo a\\\"\"", ShellHelper.BuildArgumentString(new[] { "bash", "-c", ShellHelper.BuildArgumentString(new []{"bash", "-c", "echo a"}) })); |
| 33 | + Assert.Equal("bash -c \"bash -c \\\"echo \\\\\\\"a\\\\\\\"\\\"\"", ShellHelper.BuildArgumentString(new[] { "bash", "-c", ShellHelper.BuildArgumentString(new[] { "bash", "-c", "echo \"a\"" }) })); |
36 | 34 | } |
37 | 35 | } |
38 | 36 | } |
0 commit comments