@@ -222,40 +222,22 @@ public void TestSignedUrl()
222222 Assert . AreEqual ( expected , actual ) ;
223223 }
224224
225- [ Test ]
226- public void TestSignedAnsiAndUnicodeUrl ( )
225+ [ TestCase ( "testFolder/%20Test Image_僅測試" , "s--MIMNFCL4--/c_scale,h_200,w_300/v1/testFolder/%2520Test%20Image_%E5%83%85%E6%B8%AC%E8%A9%A6.jpg" ) ]
226+ [ TestCase ( "testFolder/TestImage_僅測試" , "s--FvJh0bXb--/c_scale,h_200,w_300/v1/testFolder/TestImage_%E5%83%85%E6%B8%AC%E8%A9%A6.jpg" ) ]
227+ [ TestCase ( "testFolder/Test Image_僅測試" , "s--_jfm-XyC--/c_scale,h_200,w_300/v1/testFolder/Test%20Image_%E5%83%85%E6%B8%AC%E8%A9%A6.jpg" ) ]
228+ [ TestCase ( "testFolder/Test Image" , "s--rmmMhYpj--/c_scale,h_200,w_300/v1/testFolder/Test%20Image.jpg" ) ]
229+ [ TestCase ( "testFolder/TestImage" , "s--lzoFcAJk--/c_scale,h_200,w_300/v1/testFolder/TestImage.jpg" ) ]
230+ [ TestCase ( "testFolder/%20Test Image" , "s--AlS6-LgU--/c_scale,h_200,w_300/v1/testFolder/%2520Test%20Image.jpg" ) ]
231+ [ TestCase ( "testFolder/%20TestImage" , "s--8xAbqJri--/c_scale,h_200,w_300/v1/testFolder/%2520TestImage.jpg" ) ]
232+ public void TestSignedAnsiAndUnicodeUrl ( string publicId , string expectedPath )
227233 {
234+ var urlBuilder = m_api . UrlImgUp . Action ( "authenticated" )
235+ . Transform ( new Transformation ( ) . Crop ( "scale" ) . Height ( 200 ) . Width ( 300 ) )
236+ . Secure ( )
237+ . Signed ( true ) ;
228238
229- string [ ] sourcePublicIds = {
230- "testFolder/%20Test Image_僅測試.jpg" ,
231- "testFolder/TestImage_僅測試.jpg" ,
232- "testFolder/Test Image_僅測試.jpg" ,
233- "testFolder/Test Image.jpg" ,
234- "testFolder/TestImage.jpg" ,
235- "testFolder/%20Test Image.jpg" ,
236- "testFolder/%20TestImage.jpg"
237- } ;
238-
239- string [ ] expectedSignedUrls = {
240- "https://res.cloudinary.com/testcloud/image/authenticated/s--MIMNFCL4--/c_scale,h_200,w_300/v1/testFolder/%2520Test%20Image_%E5%83%85%E6%B8%AC%E8%A9%A6.jpg" ,
241- "https://res.cloudinary.com/testcloud/image/authenticated/s--FvJh0bXb--/c_scale,h_200,w_300/v1/testFolder/TestImage_%E5%83%85%E6%B8%AC%E8%A9%A6.jpg" ,
242- "https://res.cloudinary.com/testcloud/image/authenticated/s--_jfm-XyC--/c_scale,h_200,w_300/v1/testFolder/Test%20Image_%E5%83%85%E6%B8%AC%E8%A9%A6.jpg" ,
243- "https://res.cloudinary.com/testcloud/image/authenticated/s--rmmMhYpj--/c_scale,h_200,w_300/v1/testFolder/Test%20Image.jpg" ,
244- "https://res.cloudinary.com/testcloud/image/authenticated/s--lzoFcAJk--/c_scale,h_200,w_300/v1/testFolder/TestImage.jpg" ,
245- "https://res.cloudinary.com/testcloud/image/authenticated/s--AlS6-LgU--/c_scale,h_200,w_300/v1/testFolder/%2520Test%20Image.jpg" ,
246- "https://res.cloudinary.com/testcloud/image/authenticated/s--8xAbqJri--/c_scale,h_200,w_300/v1/testFolder/%2520TestImage.jpg"
247- } ;
248-
249- for ( int x = 0 ; x < sourcePublicIds . Length ; x ++ )
250- {
251- var actual = m_api . UrlImgUp . Action ( "authenticated" )
252- . Transform ( new Transformation ( ) . Crop ( "scale" ) . Height ( 200 ) . Width ( 300 ) )
253- . Secure ( true )
254- . Signed ( true )
255- . BuildUrl ( sourcePublicIds [ x ] ) ;
256-
257- Assert . AreEqual ( expectedSignedUrls [ x ] , actual ) ;
258- }
239+ Assert . IsTrue ( urlBuilder . BuildUrl ( $ "{ publicId } .jpg") . EndsWith ( expectedPath ) ) ;
240+ Assert . IsTrue ( urlBuilder . Format ( "jpg" ) . BuildUrl ( publicId ) . EndsWith ( expectedPath ) ) ;
259241 }
260242
261243 [ Test ]
0 commit comments