@@ -17,12 +17,23 @@ public enum PathKind
1717 ValidRelativePath ,
1818 ValidAbsoluteContainerPath ,
1919 ValidRelativeContainerPath ,
20- ValidSimpleName
20+ ValidFileName
2121 }
2222
2323 [ TestCase ( "" , PathKind . Throws ) ]
2424 [ TestCase ( null , PathKind . Throws ) ]
25- [ TestCase ( @"a" , PathKind . ValidSimpleName ) ]
25+ [ TestCase ( @"a" , PathKind . ValidFileName ) ]
26+ [ TestCase ( @"a " , PathKind . ValidFileName ) ]
27+ [ TestCase ( @"a " , PathKind . ValidFileName ) ]
28+ [ TestCase ( @"a\t" , PathKind . ValidRelativePath ) ]
29+ [ TestCase ( @"a..." , PathKind . ValidFileName ) ]
30+ [ TestCase ( @"a." , PathKind . ValidFileName ) ]
31+
32+ [ TestCase ( @" a" , PathKind . ValidFileName ) ]
33+ [ TestCase ( @" a" , PathKind . ValidFileName ) ]
34+ [ TestCase ( @"\ta" , PathKind . Invalid ) ]
35+ [ TestCase ( @"...a" , PathKind . ValidFileName ) ]
36+
2637 [ TestCase ( @"a\b" , PathKind . ValidRelativePath ) ]
2738 [ TestCase ( @"a\b\" , PathKind . ValidRelativeContainerPath ) ]
2839 [ TestCase ( @"a/b" , PathKind . ValidRelativePath ) ]
@@ -40,8 +51,8 @@ public enum PathKind
4051 [ TestCase ( @"\\a\b\" , PathKind . ValidAbsoluteContainerPath ) ]
4152 [ TestCase ( @"\\a\\b\" , PathKind . Invalid ) ]
4253 [ TestCase ( @"\\a\b/" , PathKind . Invalid ) ]
43- [ TestCase ( @".a" , PathKind . ValidSimpleName ) ]
44- [ TestCase ( @".a.b" , PathKind . ValidSimpleName ) ]
54+ [ TestCase ( @".a" , PathKind . ValidFileName ) ]
55+ [ TestCase ( @".a.b" , PathKind . ValidFileName ) ]
4556 [ TestCase ( @"..a\" , PathKind . ValidRelativeContainerPath ) ]
4657 [ TestCase ( @"..a.b\" , PathKind . ValidRelativeContainerPath ) ]
4758 [ TestCase ( @"..a..\" , PathKind . ValidRelativeContainerPath ) ]
@@ -67,8 +78,8 @@ public enum PathKind
6778 [ TestCase ( @"a:\a\..\a..b\" , PathKind . Invalid ) ]
6879 [ TestCase ( @"\" , PathKind . Invalid ) ]
6980 [ TestCase ( @"/" , PathKind . Invalid ) ]
70- [ TestCase ( @"~" , PathKind . ValidSimpleName ) ]
71- [ TestCase ( @"a" , PathKind . ValidSimpleName ) ]
81+ [ TestCase ( @"~" , PathKind . ValidFileName ) ]
82+ [ TestCase ( @"a" , PathKind . ValidFileName ) ]
7283 [ TestCase ( @"a:" , PathKind . Invalid ) ]
7384 [ TestCase ( @"a\" , PathKind . ValidRelativeContainerPath ) ]
7485 [ TestCase ( @"a/" , PathKind . ValidRelativeContainerPath ) ]
@@ -112,8 +123,8 @@ public enum PathKind
112123 [ TestCase ( @"a:\/a" , PathKind . Invalid ) ]
113124 [ TestCase ( @"a\\a" , PathKind . ValidRelativePath ) ]
114125 [ TestCase ( @"a\/a" , PathKind . ValidRelativePath ) ]
115- [ TestCase ( @"com0" , PathKind . ValidSimpleName ) ]
116- [ TestCase ( @"aux" , PathKind . ValidSimpleName ) ]
126+ [ TestCase ( @"com0" , PathKind . ValidFileName ) ]
127+ [ TestCase ( @"aux" , PathKind . ValidFileName ) ]
117128 public void TestIsWellFormedPath ( string path , PathKind pathState )
118129 {
119130 switch ( pathState )
@@ -123,49 +134,49 @@ public void TestIsWellFormedPath(string path, PathKind pathState)
123134 Assert . Throws < ArgumentException > ( ( ) => PathHelpers . IsWellFormedAbsolutePath ( path ) ) ;
124135 Assert . Throws < ArgumentException > ( ( ) => PathHelpers . IsWellFormedRelativePath ( path ) ) ;
125136 Assert . Throws < ArgumentException > ( ( ) => PathHelpers . IsWellFormedContainerPath ( path ) ) ;
126- Assert . Throws < ArgumentException > ( ( ) => PathHelpers . IsWellFormedSimpleName ( path ) ) ;
137+ Assert . Throws < ArgumentException > ( ( ) => PathHelpers . IsWellFormedFileName ( path ) ) ;
127138 break ;
128139 case PathKind . Invalid :
129140 Assert . AreEqual ( PathHelpers . IsWellFormedPath ( path ) , false ) ;
130141 Assert . AreEqual ( PathHelpers . IsWellFormedAbsolutePath ( path ) , false ) ;
131142 Assert . AreEqual ( PathHelpers . IsWellFormedRelativePath ( path ) , false ) ;
132143 Assert . AreEqual ( PathHelpers . IsWellFormedContainerPath ( path ) , false ) ;
133- Assert . AreEqual ( PathHelpers . IsWellFormedSimpleName ( path ) , false ) ;
144+ Assert . AreEqual ( PathHelpers . IsWellFormedFileName ( path ) , false ) ;
134145 break ;
135146 case PathKind . ValidAbsolutePath :
136147 Assert . AreEqual ( PathHelpers . IsWellFormedPath ( path ) , true ) ;
137148 Assert . AreEqual ( PathHelpers . IsWellFormedAbsolutePath ( path ) , true ) ;
138149 Assert . AreEqual ( PathHelpers . IsWellFormedRelativePath ( path ) , false ) ;
139150 Assert . AreEqual ( PathHelpers . IsWellFormedContainerPath ( path ) , false ) ;
140- Assert . AreEqual ( PathHelpers . IsWellFormedSimpleName ( path ) , false ) ;
151+ Assert . AreEqual ( PathHelpers . IsWellFormedFileName ( path ) , false ) ;
141152 break ;
142153 case PathKind . ValidAbsoluteContainerPath :
143154 Assert . AreEqual ( PathHelpers . IsWellFormedPath ( path ) , true ) ;
144155 Assert . AreEqual ( PathHelpers . IsWellFormedAbsolutePath ( path ) , true ) ;
145156 Assert . AreEqual ( PathHelpers . IsWellFormedRelativePath ( path ) , false ) ;
146157 Assert . AreEqual ( PathHelpers . IsWellFormedContainerPath ( path ) , true ) ;
147- Assert . AreEqual ( PathHelpers . IsWellFormedSimpleName ( path ) , false ) ;
158+ Assert . AreEqual ( PathHelpers . IsWellFormedFileName ( path ) , false ) ;
148159 break ;
149160 case PathKind . ValidRelativePath :
150161 Assert . AreEqual ( PathHelpers . IsWellFormedPath ( path ) , true ) ;
151162 Assert . AreEqual ( PathHelpers . IsWellFormedAbsolutePath ( path ) , false ) ;
152163 Assert . AreEqual ( PathHelpers . IsWellFormedRelativePath ( path ) , true ) ;
153164 Assert . AreEqual ( PathHelpers . IsWellFormedContainerPath ( path ) , false ) ;
154- Assert . AreEqual ( PathHelpers . IsWellFormedSimpleName ( path ) , false ) ;
165+ Assert . AreEqual ( PathHelpers . IsWellFormedFileName ( path ) , false ) ;
155166 break ;
156167 case PathKind . ValidRelativeContainerPath :
157168 Assert . AreEqual ( PathHelpers . IsWellFormedPath ( path ) , true ) ;
158169 Assert . AreEqual ( PathHelpers . IsWellFormedAbsolutePath ( path ) , false ) ;
159170 Assert . AreEqual ( PathHelpers . IsWellFormedRelativePath ( path ) , true ) ;
160171 Assert . AreEqual ( PathHelpers . IsWellFormedContainerPath ( path ) , true ) ;
161- Assert . AreEqual ( PathHelpers . IsWellFormedSimpleName ( path ) , false ) ;
172+ Assert . AreEqual ( PathHelpers . IsWellFormedFileName ( path ) , false ) ;
162173 break ;
163- case PathKind . ValidSimpleName :
174+ case PathKind . ValidFileName :
164175 Assert . AreEqual ( PathHelpers . IsWellFormedPath ( path ) , true ) ;
165176 Assert . AreEqual ( PathHelpers . IsWellFormedAbsolutePath ( path ) , false ) ;
166177 Assert . AreEqual ( PathHelpers . IsWellFormedRelativePath ( path ) , true ) ;
167178 Assert . AreEqual ( PathHelpers . IsWellFormedContainerPath ( path ) , false ) ;
168- Assert . AreEqual ( PathHelpers . IsWellFormedSimpleName ( path ) , true ) ;
179+ Assert . AreEqual ( PathHelpers . IsWellFormedFileName ( path ) , true ) ;
169180 break ;
170181 default :
171182 throw new ArgumentOutOfRangeException ( nameof ( pathState ) , pathState , null ) ;
@@ -236,18 +247,18 @@ public void TestEnsureContainerPath(string path, string result)
236247 [ TestCase ( @"a:/" , false ) ]
237248 [ TestCase ( @"a:\a" , false ) ]
238249 [ TestCase ( @"a:/a" , false ) ]
239- public void TestIsSimpleName ( string path , bool ? state )
250+ public void TestIsFileName ( string path , bool ? state )
240251 {
241252 switch ( state )
242253 {
243254 case null :
244- Assert . Throws < ArgumentException > ( ( ) => PathHelpers . IsSimpleName ( path ) ) ;
255+ Assert . Throws < ArgumentException > ( ( ) => PathHelpers . IsFileName ( path ) ) ;
245256 break ;
246257 case true :
247- Assert . AreEqual ( PathHelpers . IsSimpleName ( path ) , true ) ;
258+ Assert . AreEqual ( PathHelpers . IsFileName ( path ) , true ) ;
248259 break ;
249260 case false :
250- Assert . AreEqual ( PathHelpers . IsSimpleName ( path ) , false ) ;
261+ Assert . AreEqual ( PathHelpers . IsFileName ( path ) , false ) ;
251262 break ;
252263 default :
253264 throw new ArgumentOutOfRangeException ( nameof ( state ) , state , null ) ;
0 commit comments