@@ -78,67 +78,6 @@ public void ItReturnsErrorOnFileWithInvalidCodePoint()
78
78
Assert . StrictEqual < Result > ( Result . Fail , validationResult . Result ) ;
79
79
}
80
80
81
- /// <summary>
82
- /// Defines the test method ItReturnsErrorWhenCodePointIsInBoundsOfRange.
83
- /// </summary>
84
- [ Fact ]
85
- [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
86
- public void ItReturnsErrorWhenCodePointIsInBoundsOfRange ( )
87
- {
88
- var configurationMockFactory = new Moq . Mock < IConfiguration > ( ) ;
89
- List < Configuration . CodePointRange > whitelist = new List < Configuration . CodePointRange > {
90
- new Configuration . CodePointRange {
91
- Start = 0x00 ,
92
- End = 0x77 // x - 1
93
- } ,
94
- new Configuration . CodePointRange {
95
- Start = 0x7B , // z + 1
96
- End = 0x10FFFF
97
- } ,
98
- } ;
99
- configurationMockFactory . Setup ( configuration => configuration . BlacklistOfCodePoints ( ) ) . Returns ( new List < int > ( ) ) ;
100
- FilenamesCharactersValidation validation = new FilenamesCharactersValidation ( configurationMockFactory . Object ) ;
101
-
102
- var fileInfoMockFactory = new Moq . Mock < IFileInfo > ( ) ;
103
- fileInfoMockFactory . SetupGet ( fileInfo => fileInfo . Name ) . Returns ( "AAAxAAAzAAA" ) ;
104
- IValidationResult validationResult = validation . Validate ( fileInfoMockFactory . Object ) ;
105
-
106
- Assert . StrictEqual < Result > ( Result . Fail , validationResult . Result ) ;
107
- Assert . True ( validationResult . Positions . Count == 2 , $ "Unexpected number of error positions") ;
108
- Assert . True ( validationResult . Positions [ 0 ] == 4 , $ "Unexpected position of first error") ;
109
- Assert . True ( validationResult . Positions [ 1 ] == 8 , $ "Unexpected position of second error") ;
110
- }
111
-
112
- /// <summary>
113
- /// Defines the test method ItReturnsErrorWhenCodePointIsInMiddleOfRange.
114
- /// </summary>
115
- [ Fact ]
116
- [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
117
- public void ItReturnsErrorWhenCodePointIsInMiddleOfRange ( )
118
- {
119
- var configurationMockFactory = new Moq . Mock < IConfiguration > ( ) ;
120
- List < Configuration . CodePointRange > whitelist = new List < Configuration . CodePointRange > {
121
- new Configuration . CodePointRange {
122
- Start = 0x00 ,
123
- End = 0x77 // x - 1
124
- } ,
125
- new Configuration . CodePointRange {
126
- Start = 0x7B , // z + 1
127
- End = 0x10FFFF
128
- } ,
129
- } ;
130
-
131
- configurationMockFactory . Setup ( configuration => configuration . BlacklistOfCodePoints ( ) ) . Returns ( new List < int > ( ) ) ;
132
- FilenamesCharactersValidation validation = new FilenamesCharactersValidation ( configurationMockFactory . Object ) ;
133
-
134
- var fileInfoMockFactory = new Moq . Mock < IFileInfo > ( ) ;
135
- fileInfoMockFactory . SetupGet ( fileInfo => fileInfo . Name ) . Returns ( "AAAyAAA" ) ;
136
- IValidationResult validationResult = validation . Validate ( fileInfoMockFactory . Object ) ;
137
-
138
- Assert . StrictEqual < Result > ( Result . Fail , validationResult . Result ) ;
139
- Assert . True ( validationResult . Positions . Count == 1 , $ "Unexpected number of error positions") ;
140
- Assert . True ( validationResult . Positions [ 0 ] == 4 , $ "Unexpected position of first error") ;
141
- }
142
81
143
82
/// <summary>
144
83
/// Defines the test method TestWithRealConfigReturnsSuccessForValidSurrogateCodePoint.
@@ -171,16 +110,20 @@ public void TestWithRealConfigReturnsErrorForInvalidCodePoint()
171
110
fileInfoMockFactory . SetupGet ( fileInfo => fileInfo . Name ) . Returns ( new string ( new char [ ] {
172
111
'a' ,
173
112
( char ) 0xD834 , ( char ) 0xDD1E , // valid surrogate pair
174
- ( char ) 0xFFF0 , // invalid codepoint
113
+ ( char ) 0xD834 , 'a' , // invalid surrogate pair,
114
+ 'a' , ( char ) 0xDD1E , // invalid surrogate pair,
115
+ ( char ) 0xD834 , 'a' , // invalid surrogate pair,
175
116
'z' ,
176
117
( char ) 0x007C // blacklisted codepoint
177
118
} ) ) ;
178
119
IValidationResult validationResult = validation . Validate ( fileInfoMockFactory . Object ) ;
179
120
180
121
Assert . StrictEqual < Result > ( Result . Fail , validationResult . Result ) ;
181
- Assert . True ( validationResult . Positions . Count == 2 , $ "Unexpected number of error positions") ;
182
- Assert . True ( validationResult . Positions [ 0 ] == 3 , $ "Unexpected position of first error") ;
183
- Assert . True ( validationResult . Positions [ 1 ] == 5 , $ "Unexpected position of second error") ;
122
+ Assert . True ( validationResult . Positions . Count == 4 , $ "Unexpected number of error positions") ;
123
+ Assert . True ( validationResult . Positions [ 0 ] == 4 , $ "Unexpected position of first error") ;
124
+ Assert . True ( validationResult . Positions [ 1 ] == 7 , $ "Unexpected position of second error") ;
125
+ Assert . True ( validationResult . Positions [ 2 ] == 8 , $ "Unexpected position of third error") ;
126
+ Assert . True ( validationResult . Positions [ 3 ] == 11 , $ "Unexpected position of fourth error") ;
184
127
}
185
128
186
129
}
0 commit comments