Skip to content

Commit

Permalink
Update Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Nov 23, 2023
1 parent 83185aa commit 9951fd7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ public void BuildInDesignTimeMode ([Values(false, true)] bool useManagedParser)
}

[Test]
public void IfAndroidJarDoesNotExistThrowXA5207 ()
public void IfAndroidJarDoesNotExistThrowXA5207 ([Values(true, false)] bool buildingInsideVisualStudio)
{
var path = Path.Combine ("temp", TestName);
var AndroidSdkDirectory = CreateFauxAndroidSdkDirectory (Path.Combine (path, "android-sdk"), "24.0.1", new ApiInfo [] { new ApiInfo { Id = "30" } });
Expand All @@ -788,6 +788,7 @@ public void IfAndroidJarDoesNotExistThrowXA5207 ()

using (var builder = CreateApkBuilder (Path.Combine (path, proj.ProjectName), false, false)) {
builder.ThrowOnBuildFailure = false;
builder.BuildingInsideVisualStudio = buildingInsideVisualStudio;
Assert.IsTrue (builder.DesignTimeBuild (proj), "DesignTime build should succeed.");
Assert.IsFalse (builder.LastBuildOutput.ContainsText ("error XA5207:"), "XA5207 should not have been raised.");
builder.Target = "AndroidPrepareForBuild";
Expand All @@ -797,6 +798,10 @@ public void IfAndroidJarDoesNotExistThrowXA5207 ()
}), "Build should have failed");
Assert.IsTrue (builder.LastBuildOutput.ContainsText ("error XA5207:"), "XA5207 should have been raised.");
Assert.IsTrue (builder.LastBuildOutput.ContainsText ($"Could not find android.jar for API level {proj.TargetSdkVersion}"), "XA5207 should have had a good error message.");
if (buildingInsideVisualStudio)
Assert.IsTrue (builder.LastBuildOutput.ContainsText ($"Either install it in the Android SDK Manager"), "XA5207 should have an error message for Visual Studio.");
else
Assert.IsTrue (builder.LastBuildOutput.ContainsText ($"You can install the missing API level by running"), "XA5207 should have an error message for the command line.");
}
Directory.Delete (AndroidSdkDirectory, recursive: true);
}
Expand Down

0 comments on commit 9951fd7

Please sign in to comment.