1- using System . Diagnostics ;
1+ using Microsoft . Maui . IntegrationTests . Apple ;
22
33namespace Microsoft . Maui . IntegrationTests
44{
@@ -182,28 +182,6 @@ public void BuildWithDifferentVersionNumber(string id, string config, string dis
182182 $ "Project { Path . GetFileName ( projectFile ) } failed to build. Check test output/attachments for errors.") ;
183183 }
184184
185- List < string > SearchForExpectedEntitlements ( string entitlementsPath , string appLocation , List < string > expectedEntitlements )
186- {
187- List < string > foundEntitlements = new ( ) ;
188- string procOutput = ToolRunner . Run ( new ProcessStartInfo ( )
189- {
190- FileName = "/usr/bin/codesign" ,
191- Arguments = $ "-d --entitlements { entitlementsPath } --xml { appLocation } "
192- } , out int errorCode ) ;
193-
194- Assert . AreEqual ( errorCode , 0 , procOutput ) ;
195- Assert . IsTrue ( File . Exists ( entitlementsPath ) ) ;
196-
197- string fileContent = File . ReadAllText ( entitlementsPath ) ;
198- foreach ( string entitlement in expectedEntitlements )
199- {
200- if ( fileContent . Contains ( entitlement , StringComparison . OrdinalIgnoreCase ) )
201- foundEntitlements . Add ( entitlement ) ;
202- }
203-
204- return foundEntitlements ;
205- }
206-
207185 [ Test ]
208186 [ TestCase ( "maui-blazor" , "Debug" , "net8.0" ) ]
209187 [ TestCase ( "maui-blazor" , "Release" , "net8.0" ) ]
@@ -229,7 +207,7 @@ public void CheckEntitlementsForMauiBlazorOnMacCatalyst(string id, string config
229207 List < string > expectedEntitlements = config == "Release" ?
230208 new ( ) { "com.apple.security.app-sandbox" , "com.apple.security.network.client" } :
231209 new ( ) { "com.apple.security.get-task-allow" } ;
232- List < string > foundEntitlements = SearchForExpectedEntitlements ( entitlementsPath , appLocation , expectedEntitlements ) ;
210+ List < string > foundEntitlements = Codesign . SearchForExpectedEntitlements ( entitlementsPath , appLocation , expectedEntitlements ) ;
233211
234212 CollectionAssert . AreEqual ( expectedEntitlements , foundEntitlements , "Entitlements missing from executable." ) ;
235213 }
0 commit comments