コード例 #1
0
ファイル: PathTest.cs プロジェクト: kimduquan/DMIS
        public void Path_InvalidNameChar()
        {
            // try some characters that are invalid (name invalidcharpattern is [^a-zA-Z0-9.()[\\]\\-_ ])
            var chars = new char[] { '\\', ':', '?', '"', '<', '>', '|', ',', ';', '&', '#', '+', '/', '[', ']', '*' };

            foreach (char c in chars)
            {
                Assert.IsTrue(RepositoryPath.IsValidName(String.Concat("a", c, "b")) == RepositoryPath.PathResult.InvalidNameChar, string.Concat("Not recognised invalid name char: ", c));
            }
        }
コード例 #2
0
ファイル: PathTest.cs プロジェクト: kimduquan/DMIS
        public void Path_ValidNameChar()
        {
            // try some characters that are valid (name invalidcharpattern is [^a-zA-Z0-9.()[\\]\\-_ ])
            var chars = new char[] { 'b', 'V', '4', '.', '(', ')', '-', '_', ' ' };

            foreach (char c in chars)
            {
                Assert.IsTrue(RepositoryPath.IsValidName(String.Concat("a", c, "b")) == RepositoryPath.PathResult.Correct, string.Concat("Invalid name char: ", c));
            }
        }
コード例 #3
0
ファイル: PathTest.cs プロジェクト: kimduquan/DMIS
 public void Path_IsValid_WhiteSpaces()
 {
     // tab is invalid character. space is allowed, but not at beginning or end
     Assert.IsTrue(RepositoryPath.IsValidPath("/Root/ alma") == RepositoryPath.PathResult.StartsWithSpace, "#1");
     Assert.IsTrue(RepositoryPath.IsValidPath("/Root/alma ") == RepositoryPath.PathResult.EndsWithSpace, "#2");
     Assert.IsTrue(RepositoryPath.IsValidPath("/Root/	alma") == RepositoryPath.PathResult.InvalidPathChar, "#3"); // this is a TAB
     Assert.IsTrue(RepositoryPath.IsValidPath("/Root/alma	") == RepositoryPath.PathResult.InvalidPathChar, "#4");     // this is a TAB
     Assert.IsTrue(RepositoryPath.IsValidPath("/Root//alma") == RepositoryPath.PathResult.Empty, "#5");
     Assert.IsTrue(RepositoryPath.IsValidPath("/Root/\t/alma") == RepositoryPath.PathResult.InvalidPathChar, "#6");
     Assert.IsTrue(RepositoryPath.IsValidName(" alma") == RepositoryPath.PathResult.StartsWithSpace, "#7");
     Assert.IsTrue(RepositoryPath.IsValidName("alma ") == RepositoryPath.PathResult.EndsWithSpace, "#8");
     Assert.IsTrue(RepositoryPath.IsValidName("	alma") == RepositoryPath.PathResult.InvalidNameChar, "#9"); // this is a TAB
     Assert.IsTrue(RepositoryPath.IsValidName("alma	") == RepositoryPath.PathResult.InvalidNameChar, "#10");     // this is a TAB
     Assert.IsTrue(RepositoryPath.IsValidName(" ") == RepositoryPath.PathResult.StartsWithSpace, "#11");
     Assert.IsTrue(RepositoryPath.IsValidName("\t") == RepositoryPath.PathResult.InvalidNameChar, "#12");
 }