Skip to content

Commit

Permalink
[tests] add test for Microsoft.Intune
Browse files Browse the repository at this point in the history
Context: https://www.nuget.org/packages/Microsoft.Intune.Maui.Essentials.android/9.5.2-beta

The `Microsoft.Intune.Maui.Essentials.android` makes use of specific MSBuild targets and "remapping" features.

We should add a test verifying that it stays working over time.
  • Loading branch information
jonathanpeppers committed Apr 25, 2023
1 parent ca5ff9b commit ab13089
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,10 @@ public static class KnownPackages
Id = "Mono.AotProfiler.Android",
Version = "7.0.0-preview1",
};
public static Package Microsoft_Intune_Maui_Essentials_android = new Package {
Id = "Microsoft.Intune.Maui.Essentials.android",
Version = "9.5.2-beta2",
};
}
}

26 changes: 26 additions & 0 deletions tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,32 @@ public void CheckResouceIsOverridden ([Values (true, false)] bool useAapt2)
}
}

[Test]
public void MicrosoftIntune ([Values (false, true)] bool isRelease)
{
if (!Builder.UseDotNet)
Assert.Ignore ("Test is only valid in .NET 7+");
proj = new XamarinAndroidApplicationProject {
IsRelease = isRelease,
PackageReferences = {
KnownPackages.AndroidXAppCompat,
KnownPackages.Microsoft_Intune_Maui_Essentials_android,
},
};
proj.MainActivity = proj.DefaultMainActivity.Replace ("public class MainActivity : Activity", "public class MainActivity : AndroidX.AppCompat.App.AppCompatActivity");
var abis = new string [] { "armeabi-v7a", "arm64-v8a", "x86", "x86_64" };
proj.SetAndroidSupportedAbis (abis);
builder = CreateApkBuilder ();
builder.BuildLogFile = "install.log";
Assert.IsTrue (builder.Install (proj), "Install should have succeeded.");

RunProjectAndAssert (proj, builder);

var timeoutInSeconds = 120;
var didStart = WaitForActivityToStart (proj.PackageName, "MainActivity",
Path.Combine (Root, builder.ProjectDirectory, "startup-logcat.log"), timeoutInSeconds);
Assert.IsTrue (didStart, "Activity should have started.");
}

DotNetCLI CreateDotNetBuilder (string relativeProjectDir = null)
{
Expand Down

0 comments on commit ab13089

Please sign in to comment.