|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Text; |
| 5 | +using Xunit; |
| 6 | +using ModuleManager; |
| 7 | + |
| 8 | +namespace ModuleManagerTests |
| 9 | +{ |
| 10 | + public class CommandParserTest |
| 11 | + { |
| 12 | + [Fact] |
| 13 | + public void TestParse__Insert() |
| 14 | + { |
| 15 | + Assert.Equal(Command.Insert, CommandParser.Parse("PART", out string newName)); |
| 16 | + Assert.Equal("PART", newName); |
| 17 | + } |
| 18 | + |
| 19 | + [Fact] |
| 20 | + public void TestParse__Delete() |
| 21 | + { |
| 22 | + Assert.Equal(Command.Delete, CommandParser.Parse("!PART", out string newName1)); |
| 23 | + Assert.Equal("PART", newName1); |
| 24 | + Assert.Equal(Command.Delete, CommandParser.Parse("-PART", out string newName2)); |
| 25 | + Assert.Equal("PART", newName2); |
| 26 | + } |
| 27 | + |
| 28 | + [Fact] |
| 29 | + public void TestParse__Edit() |
| 30 | + { |
| 31 | + Assert.Equal(Command.Edit, CommandParser.Parse("@PART", out string newName)); |
| 32 | + Assert.Equal("PART", newName); |
| 33 | + } |
| 34 | + |
| 35 | + [Fact] |
| 36 | + public void TestParse__Replace() |
| 37 | + { |
| 38 | + Assert.Equal(Command.Replace, CommandParser.Parse("%PART", out string newName)); |
| 39 | + Assert.Equal("PART", newName); |
| 40 | + } |
| 41 | + |
| 42 | + [Fact] |
| 43 | + public void TestParse__Copy() |
| 44 | + { |
| 45 | + Assert.Equal(Command.Copy, CommandParser.Parse("+PART", out string newName1)); |
| 46 | + Assert.Equal("PART", newName1); |
| 47 | + Assert.Equal(Command.Copy, CommandParser.Parse("$PART", out string newName2)); |
| 48 | + Assert.Equal("PART", newName2); |
| 49 | + } |
| 50 | + |
| 51 | + [Fact] |
| 52 | + public void TestParse__Rename() |
| 53 | + { |
| 54 | + Assert.Equal(Command.Rename, CommandParser.Parse("|PART", out string newName)); |
| 55 | + Assert.Equal("PART", newName); ; |
| 56 | + } |
| 57 | + |
| 58 | + [Fact] |
| 59 | + public void TestParse__Paste() |
| 60 | + { |
| 61 | + Assert.Equal(Command.Paste, CommandParser.Parse("#PART", out string newName)); |
| 62 | + Assert.Equal("PART", newName); |
| 63 | + } |
| 64 | + |
| 65 | + [Fact] |
| 66 | + public void TestParse__Special() |
| 67 | + { |
| 68 | + Assert.Equal(Command.Special, CommandParser.Parse("*PART", out string newName)); |
| 69 | + Assert.Equal("PART", newName); |
| 70 | + } |
| 71 | + |
| 72 | + [Fact] |
| 73 | + public void TestParse__Special__Chained() |
| 74 | + { |
| 75 | + Assert.Equal(Command.Special, CommandParser.Parse("*@PART", out string newName)); |
| 76 | + Assert.Equal("@PART", newName); |
| 77 | + } |
| 78 | + |
| 79 | + [Fact] |
| 80 | + public void TestParse__Create() |
| 81 | + { |
| 82 | + Assert.Equal(Command.Create, CommandParser.Parse("&PART", out string newName)); |
| 83 | + Assert.Equal("PART", newName); |
| 84 | + } |
| 85 | + } |
| 86 | +} |
0 commit comments