@@ -1130,5 +1130,39 @@ public void FixLegacyResourceDesignerStep ([Values (true, false)] bool isRelease
11301130 Assert . IsTrue ( didLaunch , "Activity should have started." ) ;
11311131 }
11321132 }
1133+
1134+ [ Test ]
1135+ public void MicrosoftIntune ( [ Values ( false , true ) ] bool isRelease )
1136+ {
1137+ proj = new XamarinAndroidApplicationProject {
1138+ IsRelease = isRelease ,
1139+ PackageReferences = {
1140+ KnownPackages . AndroidXAppCompat ,
1141+ KnownPackages . Microsoft_Intune_Maui_Essentials_android ,
1142+ } ,
1143+ } ;
1144+ proj . MainActivity = proj . DefaultMainActivity
1145+ . Replace ( "Icon = \" @drawable/icon\" )]" , "Icon = \" @drawable/icon\" , Theme = \" @style/Theme.AppCompat.Light.DarkActionBar\" )]" )
1146+ . Replace ( "public class MainActivity : Activity" , "public class MainActivity : AndroidX.AppCompat.App.AppCompatActivity" ) ;
1147+ var abis = new string [ ] { "armeabi-v7a" , "arm64-v8a" , "x86" , "x86_64" } ;
1148+ proj . SetAndroidSupportedAbis ( abis ) ;
1149+ builder = CreateApkBuilder ( ) ;
1150+ builder . BuildLogFile = "install.log" ;
1151+ Assert . IsTrue ( builder . Install ( proj ) , "Install should have succeeded." ) ;
1152+
1153+ var intermediate = Path . Combine ( Root , builder . ProjectDirectory , proj . IntermediateOutputPath ) ;
1154+ var dexFile = Path . Combine ( intermediate , "android" , "bin" , "classes.dex" ) ;
1155+ FileAssert . Exists ( dexFile ) ;
1156+ var className = "Lcom/xamarin/microsoftintune/MainActivity;" ;
1157+ var methodName = "onMAMCreate" ;
1158+ Assert . IsTrue ( DexUtils . ContainsClassWithMethod ( className , methodName , "(Landroid/os/Bundle;)V" , dexFile , AndroidSdkPath ) , $ "`{ dexFile } ` should include `{ className } ` and `{ methodName } !") ;
1159+
1160+ RunProjectAndAssert ( proj , builder ) ;
1161+
1162+ WaitForPermissionActivity ( Path . Combine ( Root , builder . ProjectDirectory , "permission-logcat.log" ) ) ;
1163+ bool didLaunch = WaitForActivityToStart ( proj . PackageName , "MainActivity" ,
1164+ Path . Combine ( Root , builder . ProjectDirectory , "logcat.log" ) , 30 ) ;
1165+ Assert . IsTrue ( didLaunch , "Activity should have started." ) ;
1166+ }
11331167 }
11341168}
0 commit comments